Hướng dẫn cài đặt Directadmin cho Server khách hàng
/Cac buoc chuan bi truoc khi cai
//Disable firewall?
123 | iptables-save > ~/iptables.rules systemctl stop firewalld.service systemctl disable firewalld.service |
#Disable SELinux.
# change port ssh sang 222
1. update OS and install packages:?
12 | yum -y update 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 -y |
#reboot
2. Install Directadmin
#cai dat DA default?
123 | wget http: //www.directadmin.com/setup.sh chmod 755 setup.sh ./setup.sh |
#luu y khi cai dat chon 2 phien ban php la 7.2 va 5.6, webserver la: nginx_apache, build php-fpm
# Cai dat bo sung them mot so module thu vien cua PHP?
123456 | cd /usr/local/php72/lib/php pear update-channels pear install XML_RPC2 XML_RPC DB MDB2#mysql Mail Net_SMTP Archive_Tar cd /usr/local/php56/lib/php pear update-channels pear install XML_RPC2 XML_RPC DB MDB2#mysql Mail Net_SMTP Archive_Tar |
3. Custombuild Directadmin?
1234567891011121314 | cd /usr/local/directadmin/custombuild ./build set htscanner yes ./build set php_timezone Asia/Ho_Chi_Minh ./build set ioncube yes ./build set zend yes ./build set suhosin no ./build set mariadb 10.2 ./build set mysql_inst mariadb ./build set clamav yes ./build set awstats no ./build set webalizer yes ./build set mod_ruid2 no ./build set opcache yes ./build all d |
4. Install Redis
a. Install Redis – Server?
1234 | yum install -y redis chkconfig redis on service redis start vim /etc/redis.conf |
Change:?
123 | appendonly yes appendfsync everysec tcp-keepalive 60 |
vim /etc/sysctl.conf
change:vm.overcommit_memory = 1
b. Install Redis PHP
– install igbinary?
1234567 | wget https: //pecl.php.net/get/igbinary-2.0.8.tgz tar xzf igbinary-2.0.8.tgz cd igbinary-2.0.8 /usr/local/php72/bin/phpize ./configure --with-php-config=/usr/local/php72/bin/php-config make make install |
– install php56?
12345678 | cd .. rm -rf igbinary-2.0.8 tar xzf igbinary-2.0.8.tgz cd igbinary-2.0.8 /usr/local/php56/bin/phpize ./configure --with-php-config=/usr/local/php56/bin/php-config make make install |
– install Phpredis?
1234567 | wget https: //pecl.php.net/get/redis-3.1.4.tgz tar xzf redis-3.1.4.tgz cd redis-3.1.4 /usr/local/php72/bin/phpize ./configure --enable-redis-igbinary --with-php-config=/usr/local/php72/bin/php-config make make install |
– Install php56?
12345678 | cd .. rm -rf redis-3.1.4 tar xzf redis-3.1.4.tgz cd redis-3.1.4 /usr/local/php56/bin/phpize ./configure --enable-redis-igbinary --with-php-config=/usr/local/php56/bin/php-config make make install |
5. Install Memcached:
a. install Memcached-server?
12 | yum -y install memcached libmemcached libmemcached-devel vim /etc/sysconfig/memcached |
Change Value:?
12345 | PORT= "11211" USER= "memcached" MAXCONN= "4096" CACHESIZE= "512" OPTIONS= "-l 127.0.0.1" |
12 | chkconfig memcached on service memcached start |
b. Install Php memcached extension:?
1234567 | wget https: //pecl.php.net/get/memcached-3.1.3.tgz tar xzf memcached-3.1.3.tgz cd memcached-3.1.3 /usr/local/php72/bin/phpize ./configure --with-php-config=/usr/local/php72/bin/php-config make make install |
– Install php56?
12345678 | cd .. wget https: //pecl.php.net/get/memcached-2.2.0.tgz tar -xzvf memcached-2.2.0.tgz cd memcached-2.2.0 /usr/local/php56/bin/phpize ./configure --with-php-config=/usr/local/php56/bin/php-config make make install |
– Active module in php.ini:?
1234567 | cd /root wget http: //103.74.123.9/custom.tar.gz tar -xzvf custom.tar.gz cd custom tar -xzvf 11-loadext.ini.tar.gz cp 11-loadext.ini /usr/local/php56/lib/php.conf.d/ cp 11-loadext.ini /usr/local/php72/lib/php.conf.d/ |
6. Reload service:?
12 | service php-fpm72 restart service php-fpm56 restart |
Test load module:?
12 | /usr/local/php72/bin/php -m /usr/local/php56/bin/php -m |
7. Install Let’s encrypt?
12345678 | echo "enable_ssl_sni=1" >> /usr/local/directadmin/conf/directadmin.conf echo "letsencrypt=1" >> /usr/local/directadmin/conf/directadmin.conf echo "action=directadmin&value=restart" >> /usr/local/directadmin/data/task.queue; /usr/local/directadmin/dataskq d2000 cd /usr/local/directadmin/custombuild ./build rewrite_confs cd /usr/local/directadmin/custombuild ./build update ./build letsencrypt |
8. Config my.cnf?
12 | mv /etc/my.cnf /etc/my.cnf_bak cp /root/custom/my.cnf /etc/my.cnf |
9. Install IMAP compiled into php?
123456 | yum -y install pam-devel cd /root wget -O imap_php.sh files.directadmin.com/services/all/imap_php.sh chmod 755 imap_php.sh ./imap_php.sh service nginx restart |
10. Kiem tra sau khi hoan thanh cai dat
Tao file info.php trong /var/www/html check thông tin php
Check lại các dịch vụ sau khi cài đặt đã hoạt động chưa, trước khi bàn giao thông tin cho khách
11. Sua timezone
– Sua timezone php trong cac file php.inivi /usr/local/php56/lib/php.ini
Tim va thay sang:?
123 | date .timezone = "Asia/Ho_Chi_Minh" max_execution_time = 60 max_input_time = 90 |
—————–vi /usr/local/php72/lib/php.ini
Tim va thay sang:date.timezone = "Asia/Ho_Chi_Minh"
max_execution_time = 60
max_input_time = 90
– Update time?
123 | ntpdate vn.pool.ntp.org unlink /etc/localtime ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime |
12. Clear history?
1 | cat /dev/null > ~/.bash_history |
14. Fix Lỗi Quota
Tham khảo link: https://help.directadmin.com/item.php?id=557
15. Cài đặt CSF?
12345 | cpan -i LWP Bundle::CPAN (neu k chay duoc: yum install perl-CPAN) wget https: //download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf sh install.sh |

—————** SCRIPT **————-Tạo thư mục để lưu script tải về:
mkdir /CTinstall cd /CTinstall
Script check extension cho directadmin sau khi cài xong:
curl -sO http://103.74.123.9/script/check-ext-php.sh && bash check-ext-php.sh
Script tự động cài redis, và memache:
curl -sO http://103.74.123.9/script/memcache-redis.sh && bash memcache-redis.sh
Hướng dẫn sử dụng script:
Các script sau khi chạy sẽ báo kết quả cài đặt lên terminal và lưu log vào thư mục /CTinstall , sau khi check xong xóa file log tạo ra và xóa script.