本地終端(iTerm)連接阿里云服務(wù)器
- 本地連接阿里云服務(wù)器
ssh root@IP # 如:root@111.111.111.111) root@IP's password: # 輸入root用戶的密碼
- 如果出現(xiàn)指紋不匹配挨队,或者變更,請(qǐng)刪除本地指紋
cd /Users/XXX/.ssh # 進(jìn)入.ssh文件目錄 rm XXXX # 刪除對(duì)應(yīng)的指紋秘鑰)
安裝LNMP
- 安裝screen(安裝LNMP之前需要安裝screen命令)
Screen是一個(gè)可以在多個(gè)進(jìn)程之間多路復(fù)用一個(gè)物理終端的全屏窗口管理器糕簿。
執(zhí)行screen -S lnmp
以后栅受,如果提示:screen: command not found侵佃,則需要安裝涂圆。# 安裝screen命令 yum install screen; # 方法1 apt-get install screen; # 方法2
- 下載并安裝LNMP,一鍵安裝包
本文安裝的是當(dāng)前最新版本的lnmp1.6檐春,查看最新版本:查看最新版本
如果需要安裝lnmpa的話顽聂,只需要將/install.sh后面的lnmp替換為lnmpa即可肥惭。
如果需要修改網(wǎng)站和數(shù)據(jù)庫目錄、Nginx參數(shù)紊搪、PHP參數(shù)等需要在運(yùn)行./install.sh之前修改安裝包目錄下的lnmp.conf文件蜜葱。
如果提示wget: command not found,請(qǐng)先安裝wget命令wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6 && ./install.sh lnmp
運(yùn)行上述安裝lnmp命令以后耀石,如出現(xiàn)yum install wget; # 方法1 apt-get install wget; # 方法2
請(qǐng)根據(jù)自己的需求選擇對(duì)應(yīng)的MySQL/MariaDB版本牵囤。You have 10 options for your DataBase install. 1: Install MySQL 5.1.73 ... 4: Install MySQL 5.7.22 ... 0: DO NOT Install MySQL/MariaDB Enter your choice (1,2,3,4,5,6,7,8,9 or 0): 4 # 選擇對(duì)應(yīng)的MySQL版本
選擇數(shù)據(jù)庫版本以后,下一步會(huì)讓你設(shè)置數(shù)據(jù)庫的root用戶密碼滞伟,如
設(shè)置完密碼揭鳞,下一步詢問是否需要啟用MySQL InnoDB引擎,默認(rèn)為開啟梆奈,一般建議開啟野崇,直接回車/y即可。Please setup root password of MySQL. Please enter: ****** # 輸入MySQL的root用戶密碼
下一步選擇PHP的安裝版本亩钟,如Do you want to enable or disable the InnoDB Storage Engine? Default enable,Enter your choice [Y/n]: y # 一般Y即可
注意:選擇PHP 7+版本時(shí)需要自行確認(rèn)PHP版本是否與自己的程序兼容乓梨。You have 9 options for your PHP install. 1: Install PHP 5.2.17 ... 9: Install PHP 7.3.6
下一步提示是否安裝內(nèi)存優(yōu)化:
下一步進(jìn)入安裝環(huán)節(jié)鳖轰,安裝時(shí)間幾十分鐘至幾個(gè)小時(shí)不等,取決于機(jī)器配置和網(wǎng)速扶镀。You have 3 options for your Memory Allocator install. 1: Don't install Memory Allocator.(Default) ... Enter your choice (1, 2 or 3): # 直接回車就好
… 靜靜的等待 ...
… 靜靜的等待 ...
… 靜靜的等待 ...
如果顯示Nginx: OK蕴侣,MySQL: OK,PHP: OK
臭觉,即表示安裝成功昆雀。 - lnmp狀態(tài)管理
LNMP 1.2+狀態(tài)管理:lnmp {start|stop|reload|restart|kill|status}
LNMP 1.2+各個(gè)程序狀態(tài)管理:lnmp {nginx|mysql|mariadb|php-fpm|pureftpd} {start|stop|reload|restart|kill|status}
示例:
lnmp status; # lnmp狀態(tài)
lnmp reload; # lnmp重啟
lnmp nginx reload; # nginx啟動(dòng)
lnmp mysql reload; # nginx啟動(dòng)
- 安裝FTP服務(wù)器
安裝lnmp不會(huì)自動(dòng)安裝FTP服務(wù)器,但是一鍵安裝包里有pureftpd安裝腳本
在當(dāng)前用戶目錄下蝠筑,進(jìn)入lnmp解壓的目錄狞膘,執(zhí)行
如出現(xiàn):Press any key to install...or Press Ctrl+c to cancel,按任意鍵安裝菱肖,<kbd>Ctrl</kbd>+<kbd>c</kbd>取消安裝客冈。cd lnmp1.6; # 進(jìn)入lnmp解壓目錄(一般在當(dāng)前用戶根目錄) ./pureftpd.sh # 執(zhí)行安裝Pureftpd
當(dāng)顯示上面這段內(nèi)容時(shí)旭从,說明你的FTP服務(wù)器已經(jīng)安裝成功稳强。可以通過Starting pureftpd... Starting Pure-FTPd... done +----------------------------------------------------------------------+ | Install Pure-FTPd completed,enjoy it! | =>use command: lnmp ftp {add|list|del|show} to manage FTP users. +----------------------------------------------------------------------+ | For more information please visit https://lnmp.org +----------------------------------------------------------------------+
lnmp ftp {add|list|del|show}
來管理FTP用戶和悦。
(1)查看FTP用戶列表
(2)查看指定FTP用戶詳情lnmp ftp list; # 查看FTP用戶 xxx /home/wwwroot/xxx/./ yyy /home/wwwroot/xxx/./
(3)添加FTP用戶lnmp ftp show; # 查看ftp指定的用戶信息 Enter ftp account name: xxx # 輸入ftp用戶名xxx Your ftp account xxx details: Login : xxx Password : *******. UID : 1001 (www) GID : 1001 (www) Directory : /home/wwwroot/xxx.net/./ Full name : Download bandwidth : 0 Kb (unlimited) Upload bandwidth : 0 Kb (unlimited) Max files : 0 (unlimited) Max size : 0 Mb (unlimited) Ratio : 0:0 (unlimited:unlimited) Allowed local IPs : Denied local IPs : Allowed client IPs : Denied client IPs : Time restrictions : 0000-0000 (unlimited) Max sim sessions : 0 (unlimited)
(4)刪除FTP用戶lnmp ftp add; # 執(zhí)行添加FTP賬號(hào)操作 Enter ftp account name: xxx # 輸入FTP賬號(hào)名 Enter password for ftp account xxx: *** # 輸入FTP密碼 Enter directory for ftp account xxx: *** # 輸入FTP目錄(以/開始的真實(shí)存在的目錄) Created FTP User: xxx Sucessfully. # 表示FTP賬號(hào)xxx創(chuàng)建成功
(5)本地連接FTP服務(wù)器lnmp ftp del; # 執(zhí)行刪除FTP賬號(hào)操作 Enter ftp account name: xxx # 輸入要?jiǎng)h除的FTP賬號(hào) Your will delete ftp user xxx # 準(zhǔn)備刪除FTP賬號(hào)xxx Sleep 3s,Press ctrl+c to cancel... # 刪除倒計(jì)時(shí)(3秒內(nèi)按Ctrl+c可以取消) FTP User: xxx deleted Sucessfully. # 刪除FTP xxx成功
使用工具FileZilla連接FTP服務(wù)器退疫。- 下載FileZilla工具,自行選擇Window鸽素、Mac褒繁、Linux版本下載。
- 安裝FileZilla(略過)
- 使用FileZilla連接FTP服務(wù)器
點(diǎn)擊 文件>站點(diǎn)管理器>新建站點(diǎn)馍忽,配置選項(xiàng)如下:名稱 選項(xiàng) 協(xié)議 FTP - 文件傳輸協(xié)議 主機(jī) FTP服務(wù)器的外網(wǎng)IP地址 端口 21(默認(rèn)21) 加密碼 只使用明文FTP(不安全) 登錄類型 正常 用戶名 xxx 密碼 ***
331 User xxx OK. Password required
421 Home directory not available - aborting
本文參考至:lnmp一鍵安裝