9x8hk安裝Centos 7.2 裝19908836661數據庫的包
CentOS(Community Enterprise Operating System,中文意思是:社區企業操作系統)是Linux發行版之一,它是來自於Red Hat Enterprise Linux依照開放源代碼規定釋出的源代碼所編譯而成。由於出自同樣的源代碼,因此有些要求高度穩定性的服務器以CentOS替代商業版的Red Hat Enterprise Linux使用。兩者的不同,在於CentOS並不包含封閉源代碼軟件。
一、安裝Apache、PHP、Mysql、連接Mysql數據庫的包:
yum install httpd
yum -y install php
yum -y install php-fpm
yum -y install mysql
yum -y install mysql-server
yum -y install php-mysql
其中需要輸入Y回車,最後 Complete! 除了mysql-server其他都安裝成功!
查找原因是因為CentOS 7版本將MySQL數據庫軟件從默認的程序列表中移除,用mariadb代替了。官網下載mysql-server,然後安裝。
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
然後需要確定,輸入Y回車即可。
Centos 7.2 裝Apache、PHP、Mysql、Mysql數據庫的包、VSFTP配置
二、安裝常用擴展包
安裝Apache擴展包
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
安裝PHP擴展包
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel
安裝Mysql擴展包
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
配置Apache、mysql開機啟動
chkconfig httpd on
chkconfig mysqld on
重啟Apache、mysql服務
service mysqld restart
service php-fpm start
service httpd restart
Centos 7.2 裝Apache、PHP、Mysql、Mysql數據庫的包、VSFTP配置
三、開啟mysql 遠程訪問 3306
默認沒有密碼 直接回車
mysql -u root -p
USE mysql;
UPDATE user SET password=password("你的密碼") WHERE user=‘root‘;
GRANT ALL PRIVILEGES ON . TO ‘root‘@‘%‘ IDENTIFIED BY ‘你的密碼‘ WITH GRANT OPTION;
flush privileges;
exit;
在雲服務器後臺需要打開 3306端口、80端口、443端口。
四、安裝VSFTP、並配置
yum -y install vsftpd
然後 配置 修改 vsftpd.conf文件
vi /etc/vsftpd/vsftpd.conf
You may activate the "-R" option to the builtin ls. This is disabled by
default to avoid remote users being able to cause excessive I/O on large
sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
When "listen" directive is enabled, vsftpd runs in standalone mode and
listens on IPv4 sockets. This directive cannot be used in conjunction
with the listen_ipv6 directive.
listen=YES (有些是ON,需要改為YES)
#
This directive enables listening on IPv6 sockets. By default, listening
on the IPv6 "any" address (::) will accept connections from both IPv6
and IPv4 clients. It is not necessary to listen on both IPv4 and IPv6
sockets. If you want that (perhaps because you want to listen on specific
addresses) then you must run two copies of vsftpd with two configuration
files.
Make sure, that one of the listen options is commented !!
listen_ipv6=YES (不支持IPV6,一定要註釋掉,不然會報錯)
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
userlist_deny=NO (這裏要改為NO,默認是YES)
local_root=/var/www/html
use_localtime=YES
增加FTP帳戶
useradd lee -s /sbin/nologin
passwd lee
編輯user_list文件,允許lee用戶訪問FTP
vsftpd userlist
If userlist_deny=NO, only allow users in this file
If userlist_deny=YES (default), never allow users in this file, and
do not even prompt for a password.
Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
news
uucp
operator
games
nobody
lee
目錄設置訪問權限
chmod -R 777 /var/www/html
開啟vsftpd服務
service vsftpd start
默認開啟vsftp服務
chkconfig vsftpd on
五、Apache開啟 .htaccess
在etc/httpd/conf/httpd.conf下找到Include conf.modules.d/*.conf,在這句話下添加LoadModule rewrite_module modules/mod_rewrite.so
vi etc/httpd/conf/httpd.conf
2、在站點配置文件中添加以下配置:
<Directory /var/www/html>
AllowOverride all
</Directory>
4、重啟httpd服務,
systemctl restart httpd
9x8hk安裝Centos 7.2 裝19908836661數據庫的包