本篇文章给大家带来的内容是关于如何使用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中文網其他相關文章!

使用Linux維護模式的時機和原因:1)系統啟動問題時,2)進行重大系統更新或升級時,3)執行文件系統維護時。維護模式提供安全、控制的環境,確保操作的安全性和效率,減少對用戶的影響,並增強系統的安全性。

Linux中不可或缺的命令包括:1.ls:列出目錄內容;2.cd:改變工作目錄;3.mkdir:創建新目錄;4.rm:刪除文件或目錄;5.cp:複製文件或目錄;6.mv:移動或重命名文件或目錄。這些命令通過與內核交互執行操作,幫助用戶高效管理文件和系統。

在Linux中,文件和目錄管理使用ls、cd、mkdir、rm、cp、mv命令,權限管理使用chmod、chown、chgrp命令。 1.文件和目錄管理命令如ls-l列出詳細信息,mkdir-p遞歸創建目錄。 2.權限管理命令如chmod755file設置文件權限,chownuserfile改變文件所有者,chgrpgroupfile改變文件所屬組。這些命令基於文件系統結構和用戶、組系統,通過系統調用和元數據實現操作和控制。

MaintenancemodeInuxisAspecialBootenvironmentforforcalsystemmaintenancetasks.itallowsadMinistratorStoperFormTaskSlikerSettingPassingPassingPasswords,RepairingFilesystems,andRecoveringFrombootFailuresFailuresFailuresInamInimAlenimalenimalenrenmentrent.ToEnterMainterMainterMaintErmaintErmaintEncemememodeBoode,Interlecttheboo

Linux的核心組件包括內核、文件系統、Shell、用戶空間與內核空間、設備驅動程序以及性能優化和最佳實踐。 1)內核是系統的核心,管理硬件、內存和進程。 2)文件系統組織數據,支持多種類型如ext4、Btrfs和XFS。 3)Shell是用戶與系統交互的命令中心,支持腳本編寫。 4)用戶空間與內核空間分離,確保系統穩定性。 5)設備驅動程序連接硬件與操作系統。 6)性能優化包括調整系統配置和遵循最佳實踐。

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

Linux的維護模式可以通過GRUB菜單進入,具體步驟為:1)在GRUB菜單中選擇內核並按'e'編輯,2)在'linux'行末添加'single'或'1',3)按Ctrl X啟動。維護模式提供了一個安全環境,適用於系統修復、重置密碼和系統升級等任務。

進入Linux恢復模式的步驟是:1.重啟系統並按特定鍵進入GRUB菜單;2.選擇帶有(recoverymode)的選項;3.在恢復模式菜單中選擇操作,如fsck或root。恢復模式允許你以單用戶模式啟動系統,進行文件系統檢查和修復、編輯配置文件等操作,幫助解決系統問題。


熱AI工具

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

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

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

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

熱門文章

熱工具

WebStorm Mac版
好用的JavaScript開發工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

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