1,解决ssh登录慢的问题记录
vim /etc/ssh/ssh_config # GSSAPIAuthentication no 把下面这一行的注释去掉
2,Linux查看当前是什么系统
centos cat /etc/redhat-release ubuntu cat /etc/issue sudo runlevel
常用方法:find / -name php.ini grep -Fnr class ./ which|whereis nginx ps -ef | grep nginx ps aux | grep nginx
ps -eo pid,user,group,args,etime,lstart chmod 777 xxx || chmod u+x 脚本名 kill xx kill -9 $(pgrep nginx)
3,下载与安装
yum upgrade
手动配文件自动安装:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1
http://mirror.centos.org/centos/7/os/x86_64/Packages/
rpm -Uvh yum-3.2.29-17.el6.centos.noarch.rpm
手动下载安装
wget http://nginx.org/download/nginx-1.2.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure
make && make install
4,自动加载与定时执行 chmod +x /etc/rc.local
vi /etc/rc.local
touch /var/lock/subsys/local
sudo service php-fpm start
sudo service nginx start
sudo service mariadb start
memcached -d m 256 -u root -l 127.0.0.1 -p 11211 -c 510
php /home/menusifu/nginx/html/workerman/start.php start -d
1,/etc/rc.local
step1. 先修改好脚本,使其所有模块都能在任意目录启动时正常执行;
step2. 再在/etc/rc.local的末尾添加一行以绝对路径启动脚本的行;
2,/etc/init.d
# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for
# higher quality random number generation.
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
hkconfig --levels 245 mysqld off
$ chown -R root /etc/rc.d/init.d/apache
$ chmod 700 /etc/rc.d/init.d/apache
$ ll /etc/rc.d/rc3.d/
sudo runlevel
update-rc.d mysql start 98 3 .
/etc/rc3.d
3,移除符号链接
update-rc.d -f s10 remove
5,防火
yum install iptables-services
systemctl enable iptables
systemctl [stop|start|restart] iptables OR service iptables status
vi /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 11211 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22999 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9696 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 27017 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT