Centos 7.2 安装Apache、PHP、Mysql、连接Mysql数据库的包、安装VSFTP、并配置

一、安装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回车即可。
二、安装常用扩展包
安装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

三、开启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
mail
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

未完待续。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值