2018年8月19日 星期日

Vmware player架設centos & ftp


root/root 帳密

每次重啟都需要開啟網路服務:

service  network restart

or

systemctl status network

1.網路配置 https://blog.csdn.net/qq_33182045/article/details/55669031
2.cd /etc/sysconfig/network-scripts/ 看ifcfg-enpXXX 檔案
3.vi 此檔案
4.確定ONBOOT=yes
5.vi存檔方法ese按出後,打入wq存檔。
6.shutdown -r
7.切換su 輸入帳密
8.輸入指令安裝圖形介面
$sudo  yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

9.startx 進入圖型介面


10.ctrl + alt +F1 進入圖形介面
11.ctrl+alt+F5

在VMware Player中,并不像VMware Station中提供网络编辑功能,因此如果想使用port forward功能,则需要进行手动配置。
例如在Windows操作系统中,找到vmware nat的配置文件:
C:\Documents and Settings\All Users\Application Data\VMware\vmnetnat.conf


---------------------------------------
12.安裝EPEL
yum -y install epel-release

13.安裝 VIM
yum -y install vim


14.安裝 LAMP (Linux + Apache + MySQL / MariaDB + PHP / Python / Perl)
sudo yum -y install httpd php-mysql mysql-server php70w php70w-mysql

yum -y install mysql

yum -y install mariadb-server

ls -a /usr/lib/systemd/system/mariadb.*



enable 會在作業系統啟動時,自動啟動服務
systemctl enable  mariadb

start, stop, restart 等參數操作服務,不會有訊息
systemctl start  mariadb

用 status 檢查服務狀態
systemctl status  mariadb

----------------------------------------------------------


15.開啟防火牆,讓 web (port:80, 443) 流量可以穿過 firewall
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

16.開啟防火牆,讓外部可以連接 MySQL (port:3306) 流量可以穿過 firewall
查看目前支援的 service
firewall-cmd --get-services
開啟 Mysql 3306
sudo firewall-cmd --permanent --zone=public --add-service=mysql


17.啟動 httpd 與 mysql
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mysqld
sudo systemctl enable mysqld

重啟
service httpd restart
systemctl start httpd.service

18.mysql指令
剛安裝好 MariaDB 時,建議執行一次 mysql_secure_installation 這個安全性設定工具:

sudo mysql_secure_installation

mysql -V 看版本

mysql -u root -p    第一次進來root 沒有密碼 不需要打


------------------------------------------
21.安裝PHP


安装第三方仓库
sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
搜索新版 PHP

yum search php70u
安装新版 PHP
sudo yum install php70u-common php70u-fpm php70u-cli php70u-gd php70u-mysqlnd php70u-pdo php70u-mcrypt php70u-mbstring php70u-json php70u-opcache php70u-xml -y



如果apache打開不了php編譯,可以直接使用yum命令来安装apache的mod_php模块:

yum install mod_php70w

如果没有这个安装包,可以尝试着添加一下源:

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm


提醒一下安裝完畢應該會有檔案在
/etc/httpd/conf.modules.d/10-php.conf


安裝php7 mbstring
yum install php70w-mbstring



-----------------------------------------------------------------------

19.安裝phpmyadmin  記得phpmyadmin原生不支持7  需要用composer安裝

https://jsnwork.kiiuo.com/archives/2118/centos-7-%E5%AE%89%E8%A3%9D-apachephp-7mysqlphpmyadminftpssh/



不得已才用yum
yum install phpmyadmin


19-1.看設定檔案
sudo vi /etc/httpd/conf.d/phpMyAdmin.conf

19-2.  錯誤 Apache Error: No matching DirectoryIndex (index.html) found [SOLVED]
vim /etc/httpd/conf/httpd.conf
Change:

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

to:

<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

Be sure to restart Apache:

systemctl restart httpd


如果安裝phpmyadmin出現錯誤
Error: php70u-json conflicts with php-common-5.4.16-45.el7.x8664
Error: php70u-common conflicts with php-common-5.4.16-45.el7.x86_64
使用指令
yum install --skip-broken php-soap

yum install phpMyAdmin php70u-{json,tidy,process,cli,bcmath}


錯誤LOG位置
/var/log/httpd/
-----------------------------------------------------------------------

20.Linux指令

20-1.圖型介面檔案download等資料夾在 root底下
cd /root

20-2.看ip
ip addr show


21.防火牆
21-1.看狀態
service firewalld status

21-2.關閉
service firewalld stop

★★ httpd 403 forbidden 錯誤
這個問題是因為有使用 selinux 而你新增了一些檔案或目錄到「網頁目錄 /var/www/html」,明明檔案就存在,卻無法正常從瀏覽器觀看,這不是 file permission chmod 的問題,是 selinux 檔案 http 存取權限的問題,你只需要用

sudo restorecon -R -v /var/www/html/new_folder

就OK了!


檢查 SELinux 的狀態

# getenforce

暫時關閉 SELinux
# setenforce 0

--------------------------------------------------------------------------------
FTP連入設定 
https://www.jianshu.com/p/72015bc37c74
http://www.netqna.com/2014/04/centos-64-vsftpd-ftp-server.html

步驟 1:安裝 FTP 服務器
1、 安裝 vsftpd 服務器很直接,只要在終端運行下面的命令。

yum install vsftpd
2、 安裝完成後,服務先是被禁用的,因此我們需要手動啟動,並設置在下次啟動時自動啟用:

systemctl start vsftpd
systemctl enable vsftpd
3、 接下來,為了允許從外部系統訪問 FTP 服務,我們需要打開 FTP 守護進程監聽的 21 端口:

firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload


4.啟動vsftp服務
service vsftpd start
用FileZilla即可以正常連入


-停止 Firewalld

systemctl stop firewalld

-Check the Status of Firewalld

systemctl status firewalld

-重啟
systemctl start firewalld


使用root登入:

移除ftpusers 裡面的帳號
vim /etc/vsftpd/ftpusers
找到root 前面加上#號註解


移除user_list裡面的帳號
vim /etc/vsftpd/user_list
找到root 前面加上#號註解

-重啟VSFTPd
systemctl restart vsftpd.service
--------------------------------------------------------------------------------



沒有留言:

張貼留言