如何使用LAMP+WordPress的一鍵安裝腳本
本篇文章给大家带来的内容是关于如何使用LAMP+WordPress的一键安装脚本,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
#!/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 '\033[1;5;31mBEGIN \033[0m' mkdir -p /app/lamp # Install the required development kit groups echo -e '\033[1;31mInstall the group tools \033[0m' yum groupinstall -y 'development tools' echo -e '\033[1;31mFinish Installing the group tools \033[0m' # Create the function to compile and install HTTPD httpd () { # 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-share d=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 <<-EOF AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps ProxyRequests Off ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/app/lamp/httpd24/htdocs/$1 EOF cd } # Create the function to install mysql with binary package mariadb () { # Create the user useradd -r -s /sbin/nologin mysql # Unzip the file and create a soft connection and modify permissions cd /app tar xf mariadb-10.2.16-linux-x86_64.tar.gz -C /usr/local/ cd /usr/local/ ln -s mariadb-10.2.16-linux-x86_64/ mysql chown -R mysql.mysql mysql/ # Initialize the database and revise the configuration file mkdir /app/lamp/mysql chown -R mysql.mysql /app/lamp/mysql cd /usr/local/mysql/ scripts/mysql_install_db --datadir=/app/lamp/mysql --user=mysql mkdir /etc/mysql/ cp support-files/my-huge.cnf /etc/mysql/my.cnf sed -i '/^\[mysqld]/adatadir=/app/lamp/mysql' /etc/mysql/my.cnf # Preparation for startup script cp support-files/mysql.server /etc/init.d/mysqld cd } # Create the function to compile and install PHP php () { # Install the packages required for compilation yum install -y libxml2-devel bzip2-devel libmcrypt-devel # Unzip and start compiling and installing cd /app tar xf php-7.1.18.tar.bz2 &> /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 '\033[1;31mStart installing httpd \033[0m' httpd echo -e '\033[1;31mHTTPD is finished \033[0m' echo -e '\033[1;31mStart installing MariaDB \033[0m' mariadb echo -e '\033[1;31mMariaDB is finished \033[0m' echo -e '\033[1;31mStart installing PHP \033[0m' php echo -e '\033[1;31mPHP is finished \033[0m' } Main # Add the binary to the path variable echo 'PATH=/app/lamp/php/bin:/app/lamp/httpd24/bin:/usr/local/mysql/bin:$PATH' > /etc/profile.d/lamp.sh source /etc/profile.d/lamp.sh # Start the service apachectl service mysqld start service php-fpm start echo -e '\033[1;31mAll services are running \033[0m' # Building a blog site echo -e '\033[1;31mStart building the blog site \033[0m' mysql -e "create database wpdb;grant all on wpdb.* to wpuser@'localhost' identified by 'centos'" cd /app tar xf wordpress-4.9.4-zh_CN.tar.gz cp -r wordpress/* /app/lamp/httpd24/htdocs/ cd /app/lamp/httpd24/htdocs/ mv wp-config-sample.php wp-config.php sed -i '/DB_NAME/s/database_name_here/wpdb/' wp-config.php sed -i '/DB_USER/s/username_here/wpuser/' wp-config.php sed -i '/DB_PASSWORD/s/password_here/centos/' wp-config.php echo -e '\033[1;31mBlog is set up \033[0m' echo -e '\033[1;5;31mEND \033[0m' # END
以上是如何使用LAMP+WordPress的一鍵安裝腳本的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

VS Code 系統要求:操作系統:Windows 10 及以上、macOS 10.12 及以上、Linux 發行版處理器:最低 1.6 GHz,推薦 2.0 GHz 及以上內存:最低 512 MB,推薦 4 GB 及以上存儲空間:最低 250 MB,推薦 1 GB 及以上其他要求:穩定網絡連接,Xorg/Wayland(Linux)

Linux系統的五個基本組件是:1.內核,2.系統庫,3.系統實用程序,4.圖形用戶界面,5.應用程序。內核管理硬件資源,系統庫提供預編譯函數,系統實用程序用於系統管理,GUI提供可視化交互,應用程序利用這些組件實現功能。

vscode 內置終端是一個開發工具,允許在編輯器內運行命令和腳本,以簡化開發流程。如何使用 vscode 終端:通過快捷鍵 (Ctrl/Cmd ) 打開終端。輸入命令或運行腳本。使用熱鍵 (如 Ctrl L 清除終端)。更改工作目錄 (如 cd 命令)。高級功能包括調試模式、代碼片段自動補全和交互式命令歷史。

要查看 Git 倉庫地址,請執行以下步驟:1. 打開命令行並導航到倉庫目錄;2. 運行 "git remote -v" 命令;3. 查看輸出中的倉庫名稱及其相應的地址。

雖然 Notepad 無法直接運行 Java 代碼,但可以通過借助其他工具實現:使用命令行編譯器 (javac) 編譯代碼,生成字節碼文件 (filename.class)。使用 Java 解釋器 (java) 解釋字節碼,執行代碼並輸出結果。

在 Visual Studio Code(VSCode)中編寫代碼簡單易行,只需安裝 VSCode、創建項目、選擇語言、創建文件、編寫代碼、保存並運行即可。 VSCode 的優點包括跨平台、免費開源、強大功能、擴展豐富,以及輕量快速。

Linux的主要用途包括:1.服務器操作系統,2.嵌入式系統,3.桌面操作系統,4.開發和測試環境。 Linux在這些領域表現出色,提供了穩定性、安全性和高效的開發工具。

VS Code 終端命令無法使用的原因及解決辦法:未安裝必要的工具(Windows:WSL;macOS:Xcode 命令行工具)路徑配置錯誤(添加可執行文件到 PATH 環境變量中)權限問題(以管理員身份運行 VS Code)防火牆或代理限制(檢查設置,解除限制)終端設置不正確(啟用使用外部終端)VS Code 安裝損壞(重新安裝或更新)終端配置不兼容(嘗試不同的終端類型或命令)特定環境變量缺失(設置必要的環境變量)
