1 centos7 最小化安装 默认已装
cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
2 yum 版本升级 如果不是最新 建议升级一下
安装epel 源
yum update -y
yum install epel release
安装remi源
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
安装 辅助工具
yum install wget unzip unrar
3 安装 nginx 当前为 nginx1.10.1
yum install nginx
启动 service nginx start,测试是否启动成功, 测试是否正常,用浏览器访问http://127.0.0.1。(一般用最小化安装 ,采用curl http://127.0.0.1 访问即可 或者 本地ip 访问
正常的话应该看到一个nginx的欢迎页面。这个页面就是/usr/share/nginx/html/index.html,可以自行修改测试。
4 安装 php7 7.0.10
预编译先 直接粘代码即可运行
./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --disable-fileinfo
执行安装php7
make && make install
5 编辑 nginx的 变量
vi /etc/nginx/conf.d/default.conf
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
6 mariadb的安装
建立mariadb的源
vi /etc/yum.repos.d/MariaDB.repo
#MariaDB10.1CentOSrepositorylist-created
#http://mariadb.org/mariadb/repositories/
[mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安装并 执行
yum install MariaDB-server MariaDB-client