- 安装apache
yum -y install httpd
等待安装完成,然后启动apache
systemctl start httpd
然后在浏览器中输入localhost或者服务器的IP,即可查看到apache的默认页面。 2. 安装php 首先需要安装gcc,libxml2-devel,openssl
yum -y install gcc libxml2-devel openssl-devel sqlite-devel bzip2-devel libcurl-devel libxslt-devel
等待完成,然后下载php的安装包,地址:https://www.php.net/distributions/php-7.4.24.tar.gz(如果没有安装wget,请先安装然后在下载)
wget https://www.php.net/distributions/php-7.4.24.tar.gz
然后解压
tar -zvxf php-7.4.24.tar.gz
cd php-7.4.24
接下来就是编译了,
./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-fpm-user=nobody --with-fpm-group=nobody --with-curl --with-freetype-dir --enable-gd --with-gettext --with-iconv-dir --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-fpm
在编译过程中,碰到缺失依赖包的情况,一般是直接确实的依赖包后面接上-devel 或者去掉版本再接-devel,进行安装即可 注意:在编译过程中会出现No package ‘oniguruma’ found错误的错误,解决办法:
wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
tar -xvf oniguruma-6.9.4.tar.gz
cd oniguruma-6.9.4/
./autogen.sh
./configure --prefix=/usr --libdir=/lib64 //64位的系统一定要标识 --libdir=/lib64 否则还是不行
make && make install
./autogen.sh:行47: autoreconf: 未找到命令的解决办法:
yum -y install autoconf automake libtool
然后重新编译,直到完成。出现如下字样即编译成功:
Thank you for using PHP.
接下来就是
make
完了之后就是
make install
如果是权限问题,则在make 和make install 前面加上sudo 配置php
cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
chmod +x /etc/init.d/php-fpm
启动 php-fpm systemctl start php-fpm 添加环境变量
vim /etc/profile
在文件最末尾增加
PATH=$PATH:/usr/local/php/bin
export PATH
- 安装mysql
yum -y install mariadb-server
等待完成,默认密码为空 如需配置,则mysql_secure_installation ,
Enter current password for root (enter for none):
Set root password? [Y/n]
New password:
Re-enter new password:
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
|