先设置一下CentOS,并安装必要的组件 1, 关闭selinux (如果有selinux)
vi /etc/sysconfig/selinux
修改/etc/sysconfig/selinux文件中的SELINUX="" 为 disabled 再reboot重启电脑
reboot
2, 删除必要的服务
yum remove httpd php mysql nginx sendmail
3, 更新系统
yum update -y
4,安装gcc, gcc-c++等必要的组件 http://help.directadmin.com/item.php?id=354
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 db4-devel glibc.i686 openssl098e.i686 libstdc++.i686
开始安装DirectAdmin 安装DA时需要输入授权号、ID号。
wget http://www.directadmin.com/setup.sh chmod 755 setup.sh ./setup.sh
- Would you like to install these required pre-install packages? (y/n): y
是否检查和安装DA的必要组件,选择y
输入Client ID与License ID
Please enter your Client ID : Please enter your License ID :
输入主机名,必须是二级域名,如:myvps.openos.org,这里一定要输入二级域名,如果输入myvps类似的会报错
Enter your hostname (FQDN) :myvps.openos.org
选择你的外网IP Enter the device name: 一般独立主机是eth0, VPS可能是eth0:0, venet0:0, 一般情况下多网卡、多IP或VPS才会出现这个选项
You can make changes from the default settings in the next step.
1: custombuild 2.0: Apache 2.4, mod_ruid2, php 5.6. Can be set to use mod_php, php-FPM or fastcgi. 2: custombuild 2.0: Apache 2.4, mod_ruid2, php 5.5 (php 5.5 is end-of-life) 4: custombuild 2.0: Apache 2.4, php-fpm, php 5.6.
Post any issues with custombuild to the forum: http://forum.directadmin.com/forumdisplay.php?f=61
Note: due to the current OS, some options are hidden because you must use CustomBuild 2.0 Enter your choice (1, 2, 3 or 4): 1
选择安装属性包, 一般建议选择1, 如果是CentOS 7.x不会出现这个选择,自动默认为custombuild 2.0,并且MySQL自动换成MariaDB.
安装过程中遇到选择(y/n),一路y 如果不出意外, 到最后你会看到
Admin username: admin Admin password: OpDnXRppnXyW Admin email: admin@myvps.openos.org Server IP: 47.74.xxx.xxx Server Hostname: myvps.openos.org To login now, follow this link: http://47.74.xxx.xxx:2222
把这些信息记住就可以了. 登录后之后记得更改密码哦 若无法登录请检测防火墙设置
iptables -L -n iptables -I INPUT -p tcp --dport 22 -j ACCEPT iptables -I INPUT -p tcp --dport 2222 -j ACCEPT iptables -I INPUT -p tcp --dport 80 -j ACCEPT iptables -I INPUT -p tcp --dport 443 -j ACCEPT iptables -I INPUT -p tcp --dport 21 -j ACCEPT service iptables save service iptables restart
以下是根据自己的需要设置
安装Nginx+Apache http://forum.directadmin.com/showthread.php?t=44743
cd /usr/local/directadmin/custombuild ./build update ./build set webserver nginx_apache ./build nginx_apache ./build rewrite_confs
把默认的Apache改为Nginx https://help.directadmin.com/item.php?id=556
cd /usr/local/directadmin/custombuild ./build set webserver nginx ./build set php1_mode php-fpm ./build set php2_mode php-fpm (如果安装了两个版本的php) ./build update ./build all d ./build rewrite_confs
DirectAdmin 设置多版本PHP(如php 5.6 + php 7.1)的方法: 参考:https://www.vultr.com/docs/using-multiple-php-versions-on-directadmin
cd /usr/local/directadmin/custombuild ./build set php2_release 7.1 ./build update ./build php n ./build rewrite_confs
DirectAdmin 升级降级/切换PHP版本的方法: 以下是php降级到5.5的方法, 其他版本也可以参考这个设置 CustomBuild 2.0 If you’re looking to change php versions in CustomBuild 2.0, say from php 5.6 to php 5.5, you’d type:
cd /usr/local/directadmin/custombuild ./build set php1_release 5.3 ./build update ./build php n ./build rewrite_confs
安全设置 修改DirectAdmin默认访问端口,编辑directadmin.conf里面默认端口2222,注意不要与常用端口冲突。
/usr/local/directadmin/conf/directadmin.conf
重启DirectAdmin
service directadmin restart
参考这里 http://www.directadmin.com/install.html http://help.directadmin.com/item.php?id=354 http://www.directadmin.com/installguide.html
中文包 https://github.com/hostsoft/diretcadmin-chinese-lang/archive/master.zip https://github.com/zchjoe/Directadmin_Chinese_Language/archive/master.zip
语言包位置 /usr/local/directadmin/data/skins/enhanced/lang
编辑user.conf文件
vi /usr/local/directadmin/data/users/admin/user.conf
找到language=en 修改为language=cn