本篇文章给大家带来的内容是关于如何使用LAMP+WordPress的一键安装脚本,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
创一AI
AI帮你写短视频脚本
153 查看详情
#!/bin/bash# Description: This is a one-click script to compile the installation LAMP (PHP in FastCGI working mode)# Environment: centos7.5, apr-1.6.3.tar.gz, apr-util-1.6.1.tar.gz, httpd-2.4.34.tar.bz2, php-7.1.18.tar.bz2, mariadb-10.2.16-linux-x86_64.tar.gz, wordpress-4.9.4-zh_CN.tar.gz # Download the above packages and place them in the /app/ # Ensure that yum warehouses are set up, including local CDS and epel# All the services after compilation and installation are placed in /app/lamp/echo -e ' 33[1;5;31mBEGIN 33[0m'mkdir -p /app/lamp# Install the required development kit groupsecho -e ' 33[1;31mInstall the group tools 33[0m'yum groupinstall -y 'development tools'echo -e ' 33[1;31mFinish Installing the group tools 33[0m'# Create the function to compile and install HTTPDhttpd () {# Unzip and move folders cd /app tar xf apr-1.6.3.tar.gz tar xf apr-util-1.6.1.tar.gz tar xf httpd-2.4.34.tar.bz2 mv apr-1.6.3 httpd-2.4.34/srclib/apr mv apr-util-1.6.1 httpd-2.4.34/srclib/apr-util# Create the user and install the packages required for compilation useradd -r -s /sbin/nologin apache yum install -y pcre-devel openssl-devel expat-devel# Start compiling and installing cd httpd-2.4.34/ ./configure --prefix=/app/lamp/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork --with-included-apr make && make install# Modify configuration file cd /app/lamp/httpd24/conf sed -i '/^User/s/daemon/apache/' httpd.conf sed -i '/^Group/s/daemon/apache/' httpd.conf sed -i 's@^#Load.∗proxy.soLoad.∗proxy.so$@1@' httpd.conf sed -i 's@^#Load.∗fcgi.soLoad.∗fcgi.so$@1@' httpd.conf sed -i 's@[]+D.∗[]+D.∗@1index.php @' httpd.conf echo "Include conf/extra/httpd-php.conf" >> httpd.conf cd extra/ cat > httpd-php.conf < /dev/null cd php-7.1.18/ ./configure --prefix=/app/lamp/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfo make && make install# Modify some necessary files cp php.ini-production /etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm cd /app/lamp/php/etc cp php-fpm.conf.default php-fpm.conf cp php-fpm.d/www.conf.default php-fpm.d/www.conf cd}Main () { echo -e ' 33[1;31mStart installing httpd 33[0m' httpd echo -e ' 33[1;31mHTTPD is finished 33[0m' echo -e ' 33[1;31mStart installing MariaDB 33[0m' mariadb echo -e ' 33[1;31mMariaDB is finished 33[0m' echo -e ' 33[1;31mStart installing PHP 33[0m' php echo -e ' 33[1;31mPHP is finished 33[0m'}Main# Add the binary to the path variableecho 'PATH=/app/lamp/php/bin:/app/lamp/httpd24/bin:/usr/local/mysql/bin:$PATH' > /etc/profile.d/lamp.shsource /etc/profile.d/lamp.sh# Start the serviceapachectlservice mysqld startservice php-fpm startecho -e ' 33[1;31mAll services are running 33[0m'# Building a blog siteecho -e ' 33[1;31mStart building the blog site 33[0m'mysql -e "create database wpdb;grant all on wpdb.* to wpuser@'localhost' identified by 'centos'"cd /apptar xf wordpress-4.9.4-zh_CN.tar.gzcp -r wordpress/* /app/lamp/httpd24/htdocs/cd /app/lamp/httpd24/htdocs/mv wp-config-sample.php wp-config.phpsed -i '/DB_NAME/s/database_name_here/wpdb/' wp-config.phpsed -i '/DB_USER/s/username_here/wpuser/' wp-config.phpsed -i '/DB_PASSWORD/s/password_here/centos/' wp-config.phpecho -e ' 33[1;31mBlog is set up 33[0m'echo -e ' 33[1;5;31mEND 33[0m'# END
以上就是如何使用LAMP+WordPress的一键安装脚本的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/283242.html
微信扫一扫
支付宝扫一扫