Direct Admin 主机面板有提供60天的免费试用期。这是一个主机控制面板,也就是流行的三大虚拟主机控制面板之一。下面是自己在vps的服务器上安装的记录,以供参考:
准备工作:
使用 scaleway 的 vps: 51.15.215.99
开通时,输入 vps的Name (也就是你的FQDN)为 : svrh.shios.org
就用 root 用户安装DA吧,因为是使用ssh key 开通的,但是Direct Admin (以后就简称 DA)后面登陆需要用密码来登陆,所以首先需要给root用户添加好密码,并记录下来哦。
0、安装环境要求:
输入 /sbin/ifconfig 后发现不了外网IP,只有内网的:
[root@svrh ~]# /sbin/ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.64.242.105 netmask 255.255.255.254 broadcast 10.64.242.105
inet6 2001:bc8:47ac:134::1 prefixlen 64 scopeid 0x0<global>
inet6 fe80::dc1c:48ff:fe06:6035 prefixlen 64 scopeid 0x20<link>
ether de:1c:48:06:60:35 txqueuelen 1000 (Ethernet)
RX packets 1108 bytes 90779 (88.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2470 bytes 153899 (150.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
用这个命令试试:wget --bind-address=51.15.215.99 http://www.directadmin.com/index.html
不成功连接呀,后面 DA面板需要连接服务器来激活的,所以要处理一下:
DA 可以运行在 LAN/NAT 类型网络里,但要特别处理下,要不获取DA服务器授权连接有问题的:
就是手动添加一个网卡信息到系统:
Type the following before running the setup.sh:
# echo 1 > /root/.lan
1) 看下vps已有的网卡信息:
/sbin/ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.64.242.105 netmask 255.255.255.254 broadcast 10.64.242.105
inet6 2001:bc8:47ac:134::1 prefixlen 64 scopeid 0x0<global>
inet6 fe80::dc1c:48ff:fe06:6035 prefixlen 64 scopeid 0x20<link>
ether de:1c:48:06:60:35 txqueuelen 1000 (Ethernet)
2) 那就添加一个网卡: eth0:0
cd /etc/sysconfig/network-scripts
nano ifcfg-eth0:0
输入:保存退出。
DEVICE=eth0:0
BOOTPROTO=none
ONPARENT=yes
IPADDR=51.15.215.99
NETMASK=255.255.255.255
ONBOOT=yes
ARPCHECK=no
3)重启网络服务,让它生效:
/etc/init.d/network restart
/etc/init.d/startips start
4)最后确认下吧:/sbin/ifconfig
eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 51.15.215.99 netmask 255.255.255.255 broadcast 51.15.215.99
ether de:1c:48:06:60:35 txqueuelen 1000 (Ethernet)
提示: 然后在安装DA时,回答网卡时,要使用刚刚添加的外网IP的哪个:eth0:0 以及 51.15.215.99
而且安装完成后:登陆控制面板后台处理两个地方:
一是:
Link the LAN IP to your public IP using the Linked IP feature.
With this feature, you'd do the following:
Add the LAN IP to DA's IP manager. Don't assign it to any Users or Domains.
View the details of the external IP: Admin Level -> IP Manager -> Click the public/external IP.
Link the internal IP to the external IP: Select the LAN IP from the drop down.
Only select Apache, do not select DNS
二是:
Add the following value to your directadmin.conf, and restart DA:
lan_ip=192.168.1.2
where you'd replace 192.168.1.2 with the LAN IP value that should be used for outbound connections.
1、准备:
centos 7 安装需要的一些组件:yum install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel \
psmisc net-tools systemd-devel libdb-devel perl-DBI perl-Perl4-CoreLibs perl-libwww-perl xfsprogs rsyslog logrotate crontabs file kernel-headers
2. 安装DA
首先问你预案装的软件需要吗?前面已安装:选 n
输入 DA的 Client ID:123456
License ID:111111
是编译安装啊,没有用screen来了,还有没有设置虚拟内存啊。
wget https://www.directadmin.com/setup.sh
chmod 755 setup.sh
./setup.sh auto
-- 我是不带auto,好输入网卡等信息。
-------------近1小时才安装完成 -----------
Admin user created
## INSTALL_COMPLETE
## ACCOUNT_INFO
The following information has been set:
Admin username: admin
Admin password: c34646kj4gPcLW6
Admin email:
Server IP: 51.15.215.99
Server Hostname: svrh.shios.org
To login now, follow this link:
http://51.15.215.99:2222
and enter your Admin username and password when prompted.
----------------------------------------
安装完成后,接着:
1、外网ip设置:
Admin Level -> IP Manager -> Click the public/external IP
就是点击外网ip:51.15.215.99 点击 链接的ip,然后从下拉菜单选择内网ip(lan)10.64.242.105,注意:只选作用于 apache 一个选项。
2. 给 directadmin.conf 添加下面的内容,然后重启 DA: --这个文件在哪里? 先不做吧
lan_ip=10.64.242.105
对于 VPS/VDS 的安装后,为了使用https方式访问后台:
add the following to /usr/local/directadmin/conf/directadmin.conf
ethernet_dev=eth0:0 就是外网ip的那个网卡信息吧?
最好用 /sbin/ifconfig 查看确认下。
----上面的两个操作,应该是同一个文件,添加到ns1、ns1后面吧:----
lan_ip=10.64.242.105
ethernet_dev=eth0:0 <----- 这个配置文件里已经有了
然后就是使用 let's encrypt:
1. 开启 sni:配置文件中:
enable_ssl_sni=1 (默认 0 )
letsencrypt=1 已有
然后,重启DA:
2 、Add the /.well-known Alias:
cd /usr/local/directadmin/custombuild
./build rewrite_confs
3、Install the most recent version of the script
cd /usr/local/directadmin/custombuild
./build update
./build letsencrypt
分别显示:
Apache 2.4.27 and higher will not negotiate http2 with mpm_prefork. Please do not use mod_php or disable http2 in the directadmin.conf
https://www.apache.org/dist/httpd/CHANGES_2.4.27
Let's encrypt client 1.1.35 has been installed.
服务器开启ssl:
cd /usr/local/directadmin/scripts
./letsencrypt.sh request_single svrh.shios.org 4096
然后:You must then turn on SSL in DA and tell DA to use the carootcert, as well as force the hostname for SSL:
cd /usr/local/directadmin
./directadmin set ssl 1
./directadmin set carootcert /usr/local/directadmin/conf/carootcert.pem
./directadmin set ssl_redirect_host your.hostname.com
service directadmin restart
<------重启DA服务
https://51.15.215.99:2222 能够登陆,不过浏览器显示不安全
这个内网ip桥接外网来使用 let's encrypt 真有点麻烦。
看看,安装DA后,再来创建虚拟内存试试:
df -h
显示:
[root@svrh ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 19G 3.1G 15G 18% /
devtmpfs 911M 0 911M 0% /dev
tmpfs 918M 24K 918M 1% /dev/shm
tmpfs 918M 17M 902M 2% /run
tmpfs 918M 0 918M 0% /sys/fs/cgroup
/dev/vda15 99M 3.7M 95M 4% /boot/efi
tmpfs 184M 0 184M 0% /run/user/0
然后创建 Create a Swap File:
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
reboot 后再次看看:
df -h 显示:
[root@svrh ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 19G 7.1G 11G 41% /
devtmpfs 911M 0 911M 0% /dev
tmpfs 918M 24K 918M 1% /dev/shm
tmpfs 918M 17M 902M 2% /run
tmpfs 918M 0 918M 0% /sys/fs/cgroup
/dev/vda15 99M 3.7M 95M 4% /boot/efi
tmpfs 184M 0 184M 0% /run/user/0
运行好像是要快一些了。