2019独角兽企业重金招聘Python工程师标准>>>
先添加几个源:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
1,安装nginx,来自官方源
vim /etc/yum.repos.d/nginx.conf
# 粘贴以下内容
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1yum install nginx
2,安装mysql
先在这里找到系统对应的Mysql源:http://dev.mysql.com/downloads/repo/yum/
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql
mysql_secure_installation# 开启远程连接,方便调试,添加其他账号后关闭
mysql -uroot -p
#input password
use mysql;
update user set host='%' where user='root';
flush privileges;
3,安装 php56,php扩展
yum --enablerepo=remi,remi-php56 install php php-fpm php-common php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-pecl-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
这里装的有点多,看需求自己增减
4,安装redis
yum --enablerepo=remi,remi-php56 install redis php-redis
修改优化配置 ,配置开机启动, 启动实例
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysql on
service nginx start
service php-fpm start
service mysqld start
除了配置文件,所有的一切都是自动化的,所以可以写个脚本完成。