systemctl stop firewalld.service
systemctl disable firewalld.service
vi /etc/sysconfig/selinux
SELINUX=disabled
vi firewall.sh
chmod +x firewall.sh
./firewall.sh start
iptables -L
hostnamectl set-hostname 主機名稱
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
IP位址 子網域名稱 網域名稱
timedatectl list-timezones
timedatectl set-timezone 'Asia/Taipei'
date
useradd 新使用者
passwd 新使用者
yum -y remove mariadb-* postfix-*
yum -y install postfix cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-ntlm cyrus-sasl-md5 cyrus-sasl-plain dovecot
yum -y install mariadb mariadb-server mariadb-devel
yum -y install samba samba-client samba-common samba-common-libs samba-common-tools
yum -y install ntp wget lynx nmap telnet traceroute crontabs mlocate logwatch ftp screen bzip2-* git openssl-* boost-* GeoIP-*
vi /etc/profile
export LD_LIBRARY_PATH=/usr/local/lib
export LD_RUN_PATH=/usr/local/lib
yum -y groupinstall "Development Tools"
yum -y install gcc gcc-c++ make automake autoconf kernel-devel ncurses-devel curl gd file patch mlocate diffutils libzip curl-devel gd-devel gettext-devel glibc-devel glib2-devel libstdc++-devel libjpeg-devel libmcrypt-devel libpng-devel libxslt-devel libxml2-devel pcre-devel zlib-devel bison bison-devel pam-devel libc-client libc-client-devel
https://login.linode.com/login
vi /etc/dovecot/dovecot.conf
protocols = imap pop3
systemctl start dovecot
systemctl enable dovecot
systemctl start saslauthd
systemctl enable saslauthd
vi /etc/postfix/main.cf
郵件主機名稱
myhostname = 主機名稱
郵件主機網域名稱
mydomain = 網域名稱
郵件主機發信來源
myorigin = $myhostname
要監聽的網路介面
inet_interfaces = all
要收信的網域名稱
mydestination = /etc/postfix/local-host-names
帳號對照表
virtual_alias_maps = hash:/etc/postfix/virtual
設定信任網域
mynetworks_style = host
規定信任的用戶端
mynetworks = 127.0.0.0/8, 192.168.0.0/24, hash:/etc/postfix/access
規範可以幫忙 relay 的下一部 MTA 主機位址
relay_domains = $mydestination
啟動 SMTP 認證
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated
vi /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login
vi /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
vi /etc/dovecot/conf.d/10-master.conf
service auth 區塊
#unix_listener auth-userdb
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postdrop
}
設定接收的網域
vi /etc/postfix/local-host-names
設定郵件帳號對應
vi /etc/postfix/virtual
轉換對照表
postmap /etc/postfix/virtual
postmap /etc/postfix/access
systemctl start postfix
systemctl enable postfix
重新開機
https://login.linode.com/login
tar zxf make-4.2.1.tar.gz
cd make-4.2.1
./configure && make && make install && make clean
tar zxf m4-1.4.18.tar.gz
cd m4-1.4.18
./configure && make && make install && make clean
tar zxf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && make install && make clean
tar zxf automake-1.16.1.tar.gz
cd automake-1.16.1
./configure && make && make install && make clean
tar zxf libtool-2.4.6.tar.gz
cd libtool-2.4.6
./configure && make && make install && make clean
tar zxf bison-3.4.2.tar.gz
cd bison-3.4.2
./configure && make && make install && make clean
tar zxf screen-4.7.0.tar.gz
cd screen-4.7.0
./configure --prefix=/usr/local/screen && make && make install && make clean
/usr/local/screen/bin/screen
/usr/local/screen/bin/screen -S lnmp
/usr/local/screen/bin/screen -r lnmp
tar jxf jemalloc-5.2.1.tar.bz2
cd jemalloc-5.2.1
./configure --prefix=/usr/local/jemalloc && make && make install && make clean
tar zxf rarlinux-x64-5.7.1.tar.gz
cd rar
make
/usr/local/bin/rar
/usr/local/bin/unrar
tar jxf p7zip_16.02_src_all.tar.bz2
cd p7zip_16.02
cp makefile.linux_amd64 makefile.machine
make all
make test
make install
make clean
/usr/local/bin/7za
tar zxf libevent-2.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=/usr/local/libevent && make && make install && make clean
tar zxf memcached-1.5.20.tar.gz
cd memcached-1.5.20
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent && make && make install && make clean
/usr/local/memcached/bin/memcached -u daemon -d -l 127.0.0.1 -p 11211 -m 256 -t 4
tar zxf redis-4.0.14.tar.gz
cd redis-4.0.14
make
make test
make install
cd utils
./install_server.sh
/usr/local/bin/redis-server /etc/redis/6379.conf
/usr/local/bin/redis-cli
/usr/local/bin/redis-benchmark -n 10000
tar jxf curl-7.67.0.tar.bz2
cd curl-7.67.0
./configure --prefix=/usr/local/curl && make && make install && make clean
/usr/local/curl/bin/curl
tar zxf rsync-3.1.3.tar.gz
cd rsync-3.1.3
./configure --prefix=/usr/local/rsync && make && make install && make clean
/usr/local/rsync/bin/rsync
tar jxf gmp-6.1.2.tar.bz2
cd gmp-6.1.2
./configure --prefix=/usr/local/gmp && make && make install && make clean
tar zxf libsodium-1.0.18.tar.gz
cd libsodium-1.0.18
./configure --prefix=/usr/local/libsodium --with-pthreads && make && make install && make clean
tar jxf apr-1.7.0.tar.bz2
cd apr-1.7.0
./configure --prefix=/usr/local/apr && make && make install && make clean
tar jxf apr-util-1.6.1.tar.bz2
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config && make && make install && make clean
tar zxf sqlite-autoconf-3300100.tar.gz
cd sqlite-autoconf-3300100
./configure --prefix=/usr/local/sqlite3 && make && make install && make clean
/usr/local/sqlite3/bin/sqlite3
tar jxf subversion-1.9.12.tar.bz2
cd subversion-1.9.12
./configure --prefix=/usr/local/subversion --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-sqlite=/usr/local/sqlite3 && make && make install && make clean
tar zxf ImageMagick-7.0.9-2.tar.gz
cd ImageMagick-7.0.9-2
./configure --prefix=/usr/local/ImageMagick && make && make install && make clean
/usr/local/ImageMagick/bin/magick
tar zxf cmake-3.15.5.tar.gz
cd cmake-3.15.5
./configure && make && make install && make clean
tar zxf mariadb-5.5.66.tar.gz
cd mariadb-5.5.66
/usr/local/bin/cmake . -LH
/usr/local/bin/cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci && make && make install && make clean
cd /usr/local/mysql
useradd -r -s /sbin/nologin mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
cd mysql-test
perl mysql-test-run.pl
chown -R root .
chown -R mysql data
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysqld_multi.server /etc/init.d/mysql.server
vi /etc/my.cnf
character-set-server = utf8
collation-server = utf8_general_ci
default_storage_engine = MyISAM
#default_storage_engine = InnoDB
/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data &
/usr/local/mysql/bin/mysqladmin -u root password '新密碼'
/usr/local/mysql/bin/mysql_secure_installation
/usr/local/mysql/bin/mysql -u root -p
use mysql;
delete from user where Host <> 'localhost' or User <> 'root';
exit;
tar jxf postgresql-11.5.tar.gz
cd postgresql-11.5
./configure --prefix=/usr/local/pgsql --without-readline && make world && make install-world && make clean
useradd postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
vi /usr/local/pgsql/data/postgresql.conf
vi /usr/local/pgsql/data/pg_ident.conf
vi /usr/local/pgsql/data/pg_hba.conf
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/pg_ctl --help
/usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl restart -D /usr/local/pgsql/data
/usr/local/pgsql/bin/psql
alter role postgres with password '新密碼';
\q
exit
重新開機
https://login.linode.com/login
tar zxf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached --with-memcached=/usr/local/memcached --with-mysql=/usr/local/mysql/bin/mysql_config && make && make install && make clean
tar jxf nghttp2-1.39.2.tar.bz2
cd nghttp2-1.39.2
./configure --prefix=/usr/local/nghttp2 --with-boost && make && make install && make clean
tar jxf httpd-2.4.41.tar.bz2
cd httpd-2.4.41
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre --enable-mods-shared=all --enable-mpms-shared=all --enable-static-support --enable-http2 --with-nghttp2=/usr/local/nghttp2 && make && make install && make clean
tar jxf php-7.3.11.tar.bz2
cd php-7.3.11
./configure --prefix=/usr/local/php7 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-apxs2=/usr/local/apache2/bin/apxs --enable-maintainer-zts --with-tsrm-pthreads --enable-bcmath --without-bz2 --enable-calendar --enable-cgi --enable-cli --enable-ctype --with-curl=/usr/local/curl --enable-dom --without-enchant --enable-exif --enable-fileinfo --enable-filter --enable-ftp --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --without-gd --with-gettext --with-gmp=/usr/local/gmp --enable-hash --with-iconv --without-imap --disable-intl --enable-json --enable-libxml --enable-mbstring --with-mhash --enable-mysqlnd --with-mysqli=mysqlnd --with-mysql-sock --enable-opcache --with-openssl --enable-pcntl --without-pear --with-pdo-mysql=mysqlnd --with-pdo-pgsql --with-pgsql=/usr/local/pgsql --enable-phar --enable-posix --enable-session --enable-shmop --enable-simplexml --enable-soap --enable-sockets --with-sodium=/usr/local/libsodium --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-tokenizer --enable-wddx --enable-xml --enable-xmlreader --with-xmlrpc --with-xsl --with-libzip --with-zlib
make
make test
make install
make clean
cp php.ini-production /etc/php.ini
vi /usr/local/apache2/conf/httpd.conf
新增 http2 支援
LoadModule http2_module modules/mod_http2.so
新增 rewrite 支援
LoadModule rewrite_module modules/mod_rewrite.so
新增 PHP 支援
LoadModule php7_module modules/libphp7.so
變更預設伺服器資訊
ServerAdmin
ServerName
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-default.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-ssl.conf
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl restart
tar zxf imagick-3.4.4.tgz
cd imagick-3.4.4
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config --with-imagick=/usr/local/ImageMagick && make && make install && make clean
vi /etc/php.ini
extension=imagick.so
tar zxf phpredis-4.3.0.tar.gz
cd phpredis-4.3.0
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config && make && make install && make clean
vi /etc/php.ini
extension=redis.so
tar zxf geoip-1.1.1.tgz
cd geoip-1.1.1
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config --with-geoip && make && make install && make clean
vi /etc/php.ini
extension=geoip.so
chmod +x /etc/rc.d/rc.local
vi /etc/rc.d/rc.local
#啟動 firewall
/usr/local/bin/firewall.sh start
#啟動 memcached
/usr/local/memcached/bin/memcached -u daemon -d -l 127.0.0.1 -p 11211 -m 256 -t 4
#啟動 redis
/usr/local/bin/redis-server /etc/redis/6379.conf
#啟動 mysql
/usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data &
#啟動 httpd
/usr/local/apache2/bin/apachectl start
#啟動 subversion
/usr/local/subversion/bin/svnserve -d -r /home/subversion
vi /etc/ssh/sshd_config
LoginGraceTime 2m
PermitRootLogin yes
StrictModes yes
MaxAuthTries 6
MaxSessions 10
PermitEmptyPasswords no
PasswordAuthentication yes
systemctl restart sshd
vi /usr/local/apache2/conf/extra/httpd-default.conf
ServerTokens Prod
ServerSignature Off
vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
vi /etc/php.ini
expose_php = Off
https://www.linode.com/?r=db960629f2cb7dfed486aacc38109b3046d25544