0%

CentOS 6.8 筆記

OS:CentOS release 6.8 (Final)

mysql
mysql -u root
service mysqld status

apache
service httpd status
apachectl status

可以測試
apachectl configtest

sendmail
service sendmail restart

發測試信
# mail -s "title" john@example.com <<< "hello"
# sendmail -s "test" john@example.com <<< "hello~~"


有一天我在學校的主機斷電之後..
居然之後怎樣都連不上
弄了半天原來是防火牆問題…

查看現有規則
service iptables status
iptables -L -n

/etc/sysconfig/iptables
1
2
3
預設只有22 port
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

記得存不然重開會不見
service iptables save

重啟
service iptables restart

Port
netstat -tlp
netstat -tnlp


2017/07/10 Update

ref: https://serverfault.com/questions/472145/apache-httpd-not-starting-automatically-on-boot

1
2
3
4
# Apache, MySQL auto start on boot time
# Run level 2~5
chkconfig --level 2345 httpd on
chkconfig --level 2345 mysqld on