https://lnmp.org/install.html
https://www.cnblogs.com/xiaoxitest/p/6130065.html
https://lamp.sh/faq.htmlphp
LAMP是指如下幾個模塊的統稱。html
LNMP則是指Linux+Nginx+Mysql+Phpmysql
wget -c http://soft.vpser.net/lnmp/lnmp1.4-full.tar.gz && tar zxf lnmp1.4-full.tar.gz && cd lnmp1.4-full && ./install.sh lamplinux
模板 | 版本 |
MySQL | 5.7.18 |
PHP | 5.6.31 |
Apache | 2.4.27 |
(安裝約需1h-2h,看網速):
[root@localhost lnmp1.4-full]# ./install.sh lamp
+------------------------------------------------------------------------+
| LNMP V1.4 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.56 (Default)
3: Install MySQL 5.6.36
4: Install MySQL 5.7.18
5: Install MariaDB 5.5.56
6: Install MariaDB 10.0.30
7: Install MariaDB 10.1.23
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0): 4
You will install MySQL 5.7.18
===========================
Please setup root password of MySQL.(Default password: root)
Please enter: *******
MySQL root password:*******
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: y
You will enable the InnoDB Storage Engine
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38 (Default)
5: Install PHP 5.6.31
6: Install PHP 7.0.21
7: Install PHP 7.1.7
Enter your choice (1, 2, 3, 4, 5, 6 or 7): 5
You will install PHP 5.6.31
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3):
No input,You will not install Memory Allocator.
===========================
Please enter Administrator Email Address: ***@139.com
===========================
Server Administrator Email: ***@139.com
===========================
===========================
You have 2 options for your Apache install.
1: Install Apache 2.2.34 (Default)
2: Install Apache 2.4.27
Enter your choice (1 or 2): 2
You will install Apache 2.4.27redis
Press any key to install...or Press Ctrl+c to cancel
============================Install PHPMyAdmin=================================
============================phpMyAdmin install completed=======================
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ 肯定 ]
Add Startup and Starting LAMP...
Add httpd service at system startup...
start apache... (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Clean src directory...
+------------------------------------------------------------------------+
| LNMP V1.4 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
| lnmp status manage: lnmp {start|stop|reload|restart|kill|status} |
+------------------------------------------------------------------------+
| phpMyAdmin: http://IP/phpmyadmin/ |
| phpinfo: http://IP/phpinfo.php |
| Prober: http://IP/p.php |
+------------------------------------------------------------------------+
| Add VirtualHost: lnmp vhost add |
+------------------------------------------------------------------------+
| Default directory: /home/wwwroot/default |
+------------------------------------------------------------------------+
| MySQL/MariaDB root password: ********* |
+------------------------------------------------------------------------+
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Apache is running.
SUCCESS! MySQL running (28998)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN
tcp6 0 0 :::3306 :::* LISTEN
tcp6 0 0 :::111 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::61616 :::* LISTEN
tcp6 0 0 :::41852 :::* LISTEN
tcp6 0 0 :::43424 :::* LISTEN
tcp6 0 0 :::8161 :::* LISTEN
tcp6 0 0 :::10050 :::* LISTEN
tcp6 0 0 :::2181 :::* LISTEN
tcp6 0 0 :::5672 :::* LISTEN
Install lnmp takes 110 minutes.
Install lnmp V1.4 completed! enjoy it.sql
MySQL 安裝目錄
/usr/local/mysql數據庫
MySQL 配置文件: /etc/my.cnf
MySQL 數據庫目錄
/usr/local/mysql/data
MySQL 的 root 密碼。在安裝時會要求輸入,如不輸入則爲默認密碼 root)MySQL 的 root 密碼。在安裝時會要求輸入,如不輸入則爲默認密碼 root)apache
PHP 安裝目錄
/usr/local/php安全
PHP 配置文件: /usr/local/php/etc/php.ini
PHP 全部擴展配置文件目錄: /usr/local/php/php.d/
Apache 安裝目錄
/usr/local/apache
Apache 日誌目錄: /usr/local/apache/logs
Apache SSL 配置文件: /usr/local/apache/conf/extra/httpd-ssl.conf
新建站點配置文件: /usr/local/apache/conf/vhost/新建站點的配置文件名.conf網絡
phpMyAdmin 安裝目錄
/data/www/default/phpmyadmin
phpmyadmin 後臺地址: http://域名或IP/phpmyadmin/
(若目錄已更名,此處應爲更名後的地址,好比 http://域名或ip/admin_8989/)
phpmyadmin 默認用戶名:root 默認密碼:root
(安裝完成後出於安全,建議將此目錄更名,好比改成 /data/www/default/admin_8989)
LAMP狀態管理命令:
LAMP 1.2+狀態管理: lnmp {start|stop|reload|restart|kill|status}
LAMP 1.2+各個程序狀態管理: lnmp {httpd|mysql|mariadb|pureftpd} {start|stop|reload|restart|kill|status}
檢查Apached狀態
lnmp httpd status
lnmp httpd start
MySQL/MariaDB/Percona Server 命令:
/etc/init.d/mysqld (start|stop|restart|status)
Apache 命令:
/etc/init.d/httpd (start|stop|restart|status)
Memcached 命令(可選安裝)
/etc/init.d/memcached (start|stop|restart|status)
Redis 命令(可選安裝)
/etc/init.d/redis-server (start|stop|restart|status)
找到unstall.sh腳本,執行,選擇對應的安裝模式便可
Current Stack: unknow
Enter 1 to uninstall LNMP
Enter 2 to uninstall LNMPA
Enter 3 to uninstall LAMP
(Please input 1, 2 or 3): 3
You will uninstall LAMP
Please backup your configure files and mysql data!!!!!!
The following directory or files will be remove!
/usr/local/apache
/etc/init.d/httpd
/etc/init.d/None
/usr/local/php
/usr/local/zend
/etc/my.cnf
/bin/lnmp
Press any key to start...or Press Ctrl+c to cancel
Stoping LAMP...
./uninstall.sh:行135: lnmp: 未找到命令
./uninstall.sh:行136: lnmp: 未找到命令
Deleting iptables rules...
Removing httpd service at system startup...
服務 httpd 信息讀取出錯:沒有那個文件或目錄
服務 httpd 信息讀取出錯:沒有那個文件或目錄
Deleting LAMP files...
LAMP Uninstall completed.
問題1: 若是安裝後檢查MYSQl,出現如下報錯MySQL is running but PID file could not be found,須要先kill掉重啓一下就行了:
[root@localhost etc]# /etc/init.d/mysql status
ERROR! MySQL is running but PID file could not be found
[root@localhost etc]# /etc/init.d/mysql start
Starting MySQL.. SUCCESS!
[root@localhost etc]# /etc/init.d/mysql status
SUCCESS! MySQL running (37504)
[root@localhost etc]#
問題2: 安裝LAMP過程報錯,提示httpd*文件找不到
vi /root/lnmp-install.log
checking whether to enable mod_ssl... checking dependencies
checking for OpenSSL... checking for user-provided OpenSSL base directory... none
checking for OpenSSL version >= 0.9.8a... FAILED
configure: WARNING: OpenSSL version is too old
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
make: *** 沒有指明目標而且找不到 makefile。 中止。
mv: 沒法獲取"/usr/local/apache/conf/httpd.conf" 的文件狀態(stat): 沒有那個文件或目錄
cp: 沒法建立普通文件"/usr/local/apache/conf/httpd.conf": 沒有那個文件或目錄
cp: 沒法建立普通文件"/usr/local/apache/conf/extra/httpd-vhosts.conf": 沒有那個文件或目錄
cp: 沒法建立普通文件"/usr/local/apache/conf/extra/httpd-ssl.conf": 沒有那個文件或目錄
cp: 沒法建立普通文件"/usr/local/apache/conf/enable-apache-ssl-vhost-example.conf": 沒有那個文件或目錄
cp: 沒法建立普通文件"/usr/local/apache/conf/extra/httpd-default.conf": 沒有那個文件或目錄
cp: 沒法建立普通文件"/usr/local/apache/conf/extra/mod_remoteip.conf": 沒有那個文件或目錄
mkdir: 沒法建立目錄"/usr/local/apache/conf/vhost": 沒有那個文件或目錄
sed:沒法讀取 /usr/local/apache/conf/extra/httpd-vhosts.conf:沒有那個文件或目錄
^[[0;34m[+] Installing php-5.6.31^[[0m
Uncompress php-5.6.31.tar.bz2...
Write ZendGuardLoader to php.ini...
Create PHP Info Tool...
Copy PHP Prober...
Copy Opcache Control Panel...
============================Install PHPMyAdmin=================================
============================phpMyAdmin install completed=======================
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ 肯定 ]^M
Add Startup and Starting LAMP...
Add httpd service at system startup...
start apache... /etc/init.d/httpd:行87: /usr/local/apache/bin/httpd: 沒有那個文件或目錄
failed
Add mysql service at system startup...
Starting MySQL.. SUCCESS!
^[[0;31mError: Apache install failed.^[[0m
^[[0;32mMySQL: OK^[[0m
^[[0;31mError: PHP install failed.^[[0m
^[[0;31mSorry, Failed to install LNMP!^[[0m
^[[0;31mPlease visit https://bbs.vpser.net/forum-25-1.html feedback errors and logs.^[[0m
^[[0;31mYou can download /root/lnmp-install.log from your server,and upload lnmp-install.log to LNMP Forum.^[[0m
The output of /usr/local/apache/bin/apxs follows:
./configure: line 6199: /usr/local/apache/bin/apxs: No such file or directory
configure: error: Aborting
make: *** 沒有指明目標而且找不到 makefile。 中止。
make: *** 沒有規則能夠建立目標「install」。 中止。
Copy new php configure file...
Modify php.ini......
include/php.sh:行23: pear: 未找到命令
include/php.sh:行24: pecl: 未找到命令
include/php.sh:行29: php: 未找到命令
curl: (23) Failed writing body (0 != 16133)
Install ZendGuardLoader for PHP 7.1...
unavailable now.
緣由是opens-ssl的版本太低,或者沒有安裝致使。
解決辦法:yum install openssl-devel
若是安裝openssl-devel報錯,yum install 時候提示錯誤:
#yum install openssh
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* epel: ftp.cuhk.edu.hk
正在解決依賴關係
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> 正在檢查事務
---> 軟件包 openssh.x86_64.0.6.4p1-8.el7 將被 升級
--> 正在處理依賴關係 openssh = 6.4p1-8.el7,它被軟件包 openssh-clients-6.4p1-8.el7.x86_64 須要
--> 正在處理依賴關係 openssh = 6.4p1-8.el7,它被軟件包 openssh-server-6.4p1-8.el7.x86_64 須要
---> 軟件包 openssh.x86_64.0.6.6.1p1-12.el7_1 將被 升級
--> 正在處理依賴關係 openssh = 6.6.1p1-12.el7_1,它被軟件包 openssh-clients-6.6.1p1-12.el7_1.x86_64 須要
--> 正在處理依賴關係 openssh = 6.6.1p1-12.el7_1,它被軟件包 openssh-server-6.6.1p1-12.el7_1.x86_64 須要
---> 軟件包 openssh.x86_64.0.6.6.1p1-22.el7 將被 更新
--> 正在檢查事務
---> 軟件包 openssh.x86_64.0.6.4p1-8.el7 將被 升級
---> 軟件包 openssh-clients.x86_64.0.6.4p1-8.el7 將被 升級
---> 軟件包 openssh-clients.x86_64.0.6.6.1p1-12.el7_1 將被 升級
---> 軟件包 openssh-clients.x86_64.0.6.6.1p1-22.el7 將被 更新
---> 軟件包 openssh-server.x86_64.0.6.4p1-8.el7 將被 升級
---> 軟件包 openssh-server.x86_64.0.6.6.1p1-12.el7_1 將被 升級
---> 軟件包 openssh-server.x86_64.0.6.6.1p1-22.el7 將被 更新
--> 解決依賴關係完成
錯誤:軟件包:openssh-server-6.4p1-8.el7.x86_64 (@anaconda)
須要:openssh = 6.4p1-8.el7
正在刪除: openssh-6.4p1-8.el7.x86_64 (@anaconda)
openssh = 6.4p1-8.el7
更新,由: openssh-6.6.1p1-22.el7.x86_64 (base)
openssh = 6.6.1p1-22.el7
正在刪除: openssh-6.6.1p1-12.el7_1.x86_64 (installed)
openssh = 6.6.1p1-12.el7_1
更新,由: openssh-6.6.1p1-22.el7.x86_64 (base)
openssh = 6.6.1p1-22.el7
錯誤:軟件包:openssh-clients-6.4p1-8.el7.x86_64 (@anaconda)
須要:openssh = 6.4p1-8.el7
正在刪除: openssh-6.4p1-8.el7.x86_64 (@anaconda)
openssh = 6.4p1-8.el7
更新,由: openssh-6.6.1p1-22.el7.x86_64 (base)
openssh = 6.6.1p1-22.el7
正在刪除: openssh-6.6.1p1-12.el7_1.x86_64 (installed)
openssh = 6.6.1p1-12.el7_1
更新,由: openssh-6.6.1p1-22.el7.x86_64 (base)
openssh = 6.6.1p1-22.el7
您能夠嘗試添加 --skip-broken 選項來解決該問題
** 發現 3 個已存在的 RPM 數據庫問題, 'yum check' 輸出以下:
openssh-6.6.1p1-12.el7_1.x86_64 是 openssh-6.4p1-8.el7.x86_64 的副本
openssh-clients-6.6.1p1-12.el7_1.x86_64 是 openssh-clients-6.4p1-8.el7.x86_64 的副本
openssh-server-6.6.1p1-12.el7_1.x86_64 是 openssh-server-6.4p1-8.el7.x86_64 的副本
緣由:依賴Apache的安裝包
解決辦法:package-cleanup --cleandupes
package-cleanup : 用於清理本地安裝的RPM軟件包
而後再 yum install openssh
1. 安裝過程,爲避免ssh中斷致使安裝過程退出,能夠使用screen命令
linux screen 命令詳解
功能說明:
使用telnet或SSH遠程登陸linux時,若是鏈接非正常中斷(遠程機器關閉),從新鏈接時,系統將開一個新的session,沒法恢復原來的session.screen命令能夠解決這個問題。Screen工具是一個終端多路轉接器,在本質上,這意味着你可以使用一個單一的終端窗口運行多終端的應用。
用法:
1,開啓一個screen並進入:
screen -S test1 #這裏用-S表示給screen起名字,之後切換的時候比較方便。這時就進去了screen test1了。裏面能夠跑一些程序。
2,退出該screen:
Ctrl-a d #這裏的ctrl-a表示同時按ctrl鍵和a鍵,而後再單獨按d鍵。這時退到跟終端。
3,在根下查看開啓的全部screen:
screen -ls # 好比會有25764.test1 (Detached)等。
4,在根下進入某個screen:
screen -r test1 #這時又進入到指定的screen session中,或者screen -r 25764。
5,關閉該session:
exit #在該screen中退出,退到根下。
2. 安裝過程,若是網絡沒有問題,可是安裝不上,多是SELinux做怪,須要先臨時關閉。
查看SELinux狀態:一、/usr/sbin/sestatus -v ##若是SELinux status參數爲enabled即爲開啓狀態SELinux status: enabled二、getenforce ##也能夠用這個命令檢查關閉SELinux:一、臨時關閉(不用重啓機器):setenforce 0 ##設置SELinux 成爲permissive模式 ##setenforce 1 設置SELinux 成爲enforcing模式二、修改配置文件須要重啓機器:修改/etc/selinux/config 文件將SELINUX=enforcing改成SELINUX=disabled重啓機器便可