mkdir /root/software
cd /root/software
yum install -y yum-fastestmirror
wget https://wilmer.gaa.st/downloads/axel-1.0b.tar.gz
tar zxvf axel-1.0b.tar.gz
cd axel-1.0b
./configure --i18n=1
make
make install
yum -y install yum-utils
yum clean all
yum-complete-transaction --cleanup-only
iptables -A OUTPUT -p icmp -j ACCEPT (OUTPUT设置成DROP的话)
iptables -A INPUT -p icmp -j ACCEPT (INPUT设置成DROP的话)
iptables -A INPUT -i lo -p all -j ACCEPT (如果是INPUT DROP)
iptables -A OUTPUT -o lo -p all -j ACCEPT(如果是OUTPUT DROP)
丢弃坏的TCP包
iptables -A FORWARD -p TCP ! --syn -m state --state NEW -j DROP
iptables -t nat -A PREROUTING -i eth0 -s 10.0.0.0/8 -j DROP
iptables -t nat -A PREROUTING -i eth0 -s 172.16.0.0/12 -j DROP
iptables -t nat -A PREROUTING -i eth0 -s 192.168.0.0/16 -j DROP
禁止与某个具体IP的所有连接
iptables -t nat -A PREROUTING -d ip地址(0.0.0.0) -j DROP
禁用FTP(21)端口
iptables -t nat -A PREROUTING -p tcp --dport 21 -j DROP
禁止某个IP连接FTP(21)端口.
iptables -t nat -A PREROUTING -p tcp --dport 21 -d ip地址 -j DROP
drop非法连接
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP
iptables -A FORWARD -m state --state INVALID -j DROP
允许所有已经建立的和相关的连接
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
service iptables save
service iptables restart
grep 'temporary password' /var/log/mysqld.log //mysql5.7版本后,初始密码不再为空,默认随机生成,可通过该命令查询
mysql -u root -p //进入mysql
alter user root@localhost identified by '三种或以上的八位字符'; 默认需要先修改密码,才能其他操作
use mysql; //加载mysql表
UPDATE user SET Password=PASSWORD('三种或以上的八位字符') where USER='root'; //设置初始密码
FLUSH PRIVILEGES;
exit; //退出mysql管理
vi /etc/php-fpm.d/www.conf
user = nginx //默认为apache,修改与nginx一致的用户 可以先修改,安装nginx后再重启
group = nginx //默认为apache,修改与nginx一致的组 可以先修改,安装nginx后再重启
chkconfig php-fpm on
service php-fpm start
vi /etc/php-fpm.d/www.conf
user = nginx //默认为apache,修改与nginx一致的用户 可以先修改,安装nginx后再重启
group = nginx //默认为apache,修改与nginx一致的组 可以先修改,安装nginx后再重启
chkconfig php-fpm on
service php-fpm start
touch /etc/init.d/redis
vi /etc/init.d/redis
#!/bin/sh
#chkconfig: 2345 80 90
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
PATH="/data/deploy/redis/bin:$PATH"
EXEC="/data/deploy/redis/bin/redis-server"
CLIEXEC="/data/deploy/redis/bin/redis-cli"
PIDFILE="/data/deploy/redis/run/redis.pid"
CONF="/data/deploy/redis/etc/redis.conf"
PORT="6379"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed."
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running."
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $PORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped."
fi
;;
restart)
$0 stop && $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
chmod +x /etc/init.d/redis
chkconfig --add redis
chkconfig redis on
service redis start //启动redis
cd /usr/local/src/
git clone https://github.com/phpredis/phpredis.git
cd phpredis
phpize
./configure --with-php-config=php-config
make
make test
make install
vi /etc/php.ini //最底部添加下面的内容
[redis]
extension = /usr/lib64/php/modules/redis.so
chkconfig --add redis //开机自启动
3.5、YAF编译安装
cd /usr/local/src/
wget http://pecl.php.net/get/yaf-2.3.5.tgz //需与PHP(5.6)版本匹配
wget http://pecl.php.net/get/yaf-3.0.8.tgz //与php70版本匹配
tar zxvf yaf-2.3.5.tgz
cd yaf-2.3.5
phpize
./configure --with-php-config=/usr/bin/php-config
make
make test
make install
vi /etc/php.ini //最底部
[Yaf]
extension=/usr/lib64/php/modules/yaf.so
yaf.use_namespace = 1
yaf.environ = "develop"
php -i | grep yaf
出现下面这些内容,说明安装成功
yaf
yaf support => enabled
Supports => http://pecl.php.net/package/yaf
yaf.action_prefer => Off => Off
yaf.cache_config => Off => Off
yaf.environ => develop => develop
yaf.forward_limit => 5 => 5
yaf.library => no value => no value
yaf.lowcase_path => Off => Off
yaf.name_separator => no value => no value
yaf.name_suffix => On => On
yaf.st_compatible => Off => Off
yaf.use_namespace => On => On
yaf.use_spl_autoload => Off => Off
3.6、Nginx安装
yum install automake autoconf libtool make
yum install -y nginx
chkconfig nginx on
cd /etc/nginx
vi nginx.conf
Usage: javac
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath Specify where to find user class files and annotation processors
-cp Specify where to find user class files and annotation processors
-sourcepath Specify where to find input source files
-bootclasspath Override location of bootstrap class files
-extdirs Override location of installed extensions
-endorseddirs Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor [,,...] Names of the annotation processors to run; bypasses default discovery process
-processorpath Specify where to find annotation processors
-parameters Generate metadata for reflection on method parameters
-d Specify where to place generated class files
-s Specify where to place generated source files
-h Specify where to place generated native header files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding Specify character encoding used by source files
-source Provide source compatibility with specified release
-target Generate class files for specific VM version
-profile Check that API used is available in the specified profile
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J Pass directly to the runtime system
-Werror Terminate compilation if warnings occur
@ Read options and filenames from file