时间:2021-07-01 10:21:17 帮助过:49人阅读
1.先找到nginx的官网进去复制最新版本的下载地址在虚拟机上进行下载
wget http://nginx.org/download/nginx-1.16.0.tar.gz
2.把nginx压缩包解压到/usr/local/nginx/
tar -zxcf nginx-1.16.0.tar.gz -C /usr/local/nginx/
3.下载他所需要的包
yum -y install gcc gcc-c++ autoconf automake make openssl openssl-denel
4.下载完包以后执行:
./configure --prefix=/usr/local/nginx
5.进行make编译
make && make install
6.检查配置是否有错
cd /usr/local/nginx/sbin
执行 ./nginx -t
如果没问题的话就执行./nginx -s reload 进行重读或者./nginx执行nginx
7.然后配置etc/localhosts/ 添加自己的IP和域名(域名在/usr/local/nginx/conf/nginx.conf里查看)
8.如果是在虚拟机上看nginx的话就 curl +域名 (记得关闭防火墙和selinux)
9.如果是在浏览器上看nginx的话就要用记事本以管理员身份打开C:/windows/system32/drivers/etc/hosts/在上面添加虚拟机的IP和域名
10.关闭电脑防火墙
去官方自己找下载地址我用的是5.6.33的
1.下载压缩包
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
2.解压
tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
3.把解压后的MySQL复制到/usr/local/mysql/
cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql
4.添加用户组,添加用户到用户组
groupadd mysql
useradd -g mysql mysql
5.创建目录
cd /usr/local/mysql/data/
mkdir ./mysql
6.给目录更改用户
chown -R mysql:mysql ./
7.。
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf
8.修改启动脚本
vim /etc/init.d/mysqld
修改项:
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/mysql
9.启动测试
service mysqld start
./mysql/bin/mysql -uroot
关闭
service mysqld stop
1.下载PHP源码包,xz -d 解压 然后tar解压到/usr/local/src/
2.下载包
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel
yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel bz2-devel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install libmcrypt-devel mhash mcrypt
3.创建用户
groupadd www
useradd -g www -s /sbin/nologin -M www
./configure --prefix=/usr/local/php56 --with-config-file-path=/usr/local/php56/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline--with-gd
make
make install
5.配置文件
cp php.ini-development /usr/local/php56/etc/php.ini
6
cp /usr/local/php56/etc/php-fpm.conf.default /usr/local/php56/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm56 (php-fpm的可执行文件)
7.启动php-fpm
8.添加环境变量
9.source etc/profile 使环境变量生效
总结linux下 nginx,MySQL,PHP的安装过程
标签:自己的 需要 png 复制 创建目录 drivers glibc opcache socket