先添加几个源:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpmrpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
1,安装nginx,来自官方源
vim /etc/yum.repos.d/nginx.conf# 粘贴以下内容[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1yum install nginx
2,安装mysql
先在这里找到系统对应的Mysql源:
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpmyum install mysqlmysql_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 onchkconfig php-fpm onchkconfig mysql onservice nginx startservice php-fpm startservice mysqld start
除了配置文件,所有的一切都是自动化的,所以可以写个脚本完成。