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.rulessystemctl stop firewalld.servicesystemctl disable firewalld.service |
#Disable SELinux.
# change port ssh sang 222
1. update OS and install packages:?
| 12 | yum -y updateyum 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.shchmod 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/phppear update-channelspear install XML_RPC2 XML_RPC DB MDB2#mysql Mail Net_SMTP Archive_Tarcd /usr/local/php56/lib/phppear update-channelspear 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 redischkconfig redis onservice redis startvim /etc/redis.conf |
Change:?
| 123 | appendonly yesappendfsync everysectcp-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.tgztar xzf igbinary-2.0.8.tgzcd igbinary-2.0.8/usr/local/php72/bin/phpize./configure --with-php-config=/usr/local/php72/bin/php-configmakemake install |
– install php56?
| 12345678 | cd ..rm -rf igbinary-2.0.8tar xzf igbinary-2.0.8.tgzcd igbinary-2.0.8/usr/local/php56/bin/phpize./configure --with-php-config=/usr/local/php56/bin/php-configmakemake install |
– install Phpredis?
| 1234567 | wget https://pecl.php.net/get/redis-3.1.4.tgztar xzf redis-3.1.4.tgzcd redis-3.1.4/usr/local/php72/bin/phpize./configure --enable-redis-igbinary --with-php-config=/usr/local/php72/bin/php-configmakemake install |
– Install php56?
| 12345678 | cd ..rm -rf redis-3.1.4tar xzf redis-3.1.4.tgzcd redis-3.1.4/usr/local/php56/bin/phpize./configure --enable-redis-igbinary --with-php-config=/usr/local/php56/bin/php-configmakemake install |
5. Install Memcached:
a. install Memcached-server?
| 12 | yum -y install memcached libmemcached libmemcached-develvim /etc/sysconfig/memcached |
Change Value:?
| 12345 | PORT="11211"USER="memcached"MAXCONN="4096"CACHESIZE="512"OPTIONS="-l 127.0.0.1" |
| 12 | chkconfig memcached onservice memcached start |
b. Install Php memcached extension:?
| 1234567 | wget https://pecl.php.net/get/memcached-3.1.3.tgztar xzf memcached-3.1.3.tgzcd memcached-3.1.3/usr/local/php72/bin/phpize./configure --with-php-config=/usr/local/php72/bin/php-configmakemake install |
– Install php56?
| 12345678 | cd ..wget https://pecl.php.net/get/memcached-2.2.0.tgztar -xzvf memcached-2.2.0.tgzcd memcached-2.2.0/usr/local/php56/bin/phpize./configure --with-php-config=/usr/local/php56/bin/php-configmakemake install |
– Active module in php.ini:?
| 1234567 | cd /rootwget http://103.74.123.9/custom.tar.gztar -xzvf custom.tar.gzcd customtar -xzvf 11-loadext.ini.tar.gzcp 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 restartservice 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.confecho "letsencrypt=1" >> /usr/local/directadmin/conf/directadmin.confecho "action=directadmin&value=restart" >> /usr/local/directadmin/data/task.queue; /usr/local/directadmin/dataskq d2000cd /usr/local/directadmin/custombuild./build rewrite_confscd /usr/local/directadmin/custombuild./build update./build letsencrypt |
8. Config my.cnf?
| 12 | mv /etc/my.cnf /etc/my.cnf_bakcp /root/custom/my.cnf /etc/my.cnf |
9. Install IMAP compiled into php?
| 123456 | yum -y install pam-develcd /rootwget -O imap_php.sh files.directadmin.com/services/all/imap_php.shchmod 755 imap_php.sh./imap_php.shservice 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 = 60max_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.orgunlink /etc/localtimeln -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.tgztar -xzf csf.tgzcd csfsh 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.