标签:useradd rod load 安装 tar.gz apr c++ ext shanghai
一键安装LAMPyum install -y gcc pcre-devel openssl-devel expat-devel autoconf libtool gcc-c++ apr-devel apr-util-devel libxml2-devel bzip2-devel libmrpty-devel
#二进制安装MariaDB
tar xvf /data/mariadb-10.2.23-linux-x86_64.tar.gz
mv mariadb-10.2.23-linux-x86_64 /usr/local/mysql
cd /usr/local
ln -s mariadb-10.2.23-linux-x86_64/ mysql
useradd -r -s /sbin/nologin -d /data/mysql mysql
mkdir /data/mysql
chown -R mysql.mysql /data/mysql
chown -R root.root /usr/local/mysql
cd mysql
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql
mkdir /etc/mysql
cp support-files/my-huge.cnf /etc/mysql/my.cnf
sed -i ‘/skip-external-locking/i\datadir=/data/mysql‘ /etc/mysql/my.cnf
#设置启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
#设置环境变量
echo ‘PATH=/usr/local/mysql/bin:$PATH‘ > /etc/profile.d/lamp.sh
#启动MariaDB
service mysqld start
#install httpd
tar xvf apr-1.7.0.tar.gz
tar xvf apr-util-1.6.1.tar.gz
tar xvf httpd-2.4.39.tar.bz2
#cd httpd-2.4.39/srclib
#ln -s ../../apr-1.7.0 ./apr
#ln -s ../../apr-util-1.6.1 ./apr-util
mv apr-1.7.0 httpd-2.4.39/srclib/apr
mv apr-util-1.6.1 httpd-2.4.39/srclib/apr-util
#cd ..
cd httpd-2.4.39/
./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make -j 4 && make install
echo ‘/app/httpd24/bin/apachectl start‘ >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
. /etc/rc.d/rc.local
#设置环境变量echo ‘PATH=/app/http24/bin:$PATH‘ >> /etc/profile.d/lamp.sh
#添加apache用户
useradd -r -s /sbin/nlolgin apache
sed -ri ‘s/^(User).*/\1 apache/‘ /app/httpd24/conf/httpd.conf
sed -ri ‘s/^(Group).*/\1 apache/‘ /app/httpd24/conf/httpd.conf
/app/httpd24/bin/apachectl start
#install php
tar xvf php-7.3.5.tar.bz2
cd php-7.3.5/
./configure --prefix=/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-mbstring --enable-xml --enable-sockes --enable-fpm --enable-maintainer-zts --disable-fileinfo
make -j 4 && make install
cp php.ini-production /etc/php.ini
sed -ri ‘s/^;(date\.timezone =).*/\1 "Asia/Shanghai"/‘ /etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cd /app/php/etc
cp php-fpm.conf.default php-fpm.conf
cd /app/php/etc/php-fpm.d
cp www.conf.default www.conf
echo ‘<?php phpinfo();?>‘ > /app/httpd24/htdocs/test.php
sed -ri ‘s/^user.*/user = apache/‘ /app/php/etc/php-fpm.d/www.conf
sed -ri ‘s/^group.*/group = apache/‘ /app/php/etc/php-fpm.d/www.conf
sed -ri ‘s/^#(LoadModule proxy_module.*)/\1/‘ /app/httpd24/conf/httpd.conf
sed -ri ‘s/^#(LoadModule proxy_fcgi_module.*)/\1/‘ /app/httpd24/conf/httpd.conf
echo ‘DirectoryIndex index.php‘ >> /app/httpd24/conf/httpd.conf
echo ‘ProxyRequests off‘ >> /app/httpd24/conf/httpd.conf
echo ‘ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1‘ >> /app/httpd24/conf/httpd.conf
/app/httpd24/bin/apachectl restart
service php-fpm start
标签:useradd rod load 安装 tar.gz apr c++ ext shanghai
原文地址:https://blog.51cto.com/13749470/2396042