CentOS 7.0 lamp+ftp安装

CentOS 7.0 lamp+ftp安装

1:安装HTTP服务器和FTP服务器  yum install httpd vsftpd

2:安装安装MariaDB客户端和服务端,MariaDB本质上还是MySQL  yum install mariadb mariadb-server

3:安装php和相关模块,我选择了gd2、xml和mysql,注意这个php-mysql模块,它对应的就是MariaDB,php的版本是5.4.16

       yum install php php-gd php-xml php-mysql

4:启动安装的服务

       systemctl start vsftpd.service

       systemctl start httpd.service

       systemctl start mariadb.service

5:检查httpd.service、mariadb.service、vsftpd.service有没有enabled(开机自启动),没有就enable

       systemctl list-unit-files | grep enabled

       systemctl enable httpd.service

       systemctl enable mariadb.service

       systemctl enable vsftpd.service(这三个命令可能会出现 ln -s 请无视)

6:在root组中加入一个htmler账户用来ftp到/var/www/html并给它添加密码

       useradd -g root -M -d /var/www/html -s /sbin/nologin htmler

       passwd htmler

       输入密码

7:把/var/www/html的所有权给htmler.root

      chown -R htmler.root /var/www/html

8:配置vsftpd,禁止匿名用户登陆

      vi /etc/vsftpd/vsftpd.conf

      (INSERT)anonymous_enable=YES 改为 anonymous_enable=NO

      (ESC):wq

9:配置防火墙和SELinux

    运行下面的命令可能会出现

    

    (假如出现 先执行systemctl start firewalld.service)

      firewall-cmd --permanent --zone=public --add-service=ftp

      firewall-cmd --permanent --zone=public --add-service=http

      firewall-cmd --permanent --zone=public --add-service=https

     firewall-cmd --reload

10:查找ftp相关的SELinuxbool值,给ftp访问放行
         getsebool -a | grep ftp

       运行上面的命令可能会出现

      (假如出现 vi /etc/selinux/config 把SELINUX 设置为1,还有把SELINUXTYPE 注释掉。 然后保存,重启系统 shutdown -r now)

       setsebool -P ftpd_full_access on

       -P写入磁盘,不会重启消失,但耗时较长,耐心等待,这是最后一步了


以上内容来源于http://blog.sina.com.cn/s/blog_459ced7a0102v2ms.html

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

start

之前的内容已经安装完http、apache、php部分组件、mariadb。

我们访问服务器ip地址, 出现apache默认页面

说明前面apache安装成功

1、为root账户设置密码

mysql_secure_installation

回车,根据提示输入Y

输入2次密码,回车

根据提示一路输入Y

最后出现:Thanks for using MySQL!

MySql密码设置完成,重新启动 MySQL:

systemctl restart mariadb.service #重启MariaDB

2、apache 配置

       vi /etc/httpd/conf/httpd.conf #编辑文件

       Options Indexes FollowSymLinks  #修改为:Options Indexes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)

        #AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行) #注释去掉

        AllowOverride None  #修改为:AllowOverride All (允许.htaccess)

        DirectoryIndex index.html   #修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php(设置默认首页文件,增加index.php)

      MaxKeepAliveRequests 500  #添加MaxKeepAliveRequests 500 (增加同时连接数)

      :wq! #保存退出

      systemctl restart httpd.service #重启apache

      rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页   (后者可能没有)

3、php配置

      vi /etc/php.ini #编辑

      date.timezone = PRC #把前面的分号去掉,改为date.timezone = PRC

      short_open_tag = ON #支持php短标签

      :wq! #保存退出

      systemctl restart mariadb.service #重启MariaDB

      systemctl restart httpd.service #重启apache

4、测试

      cd /var/www/html

      vi index.php #输入下面内容

      <?php

      phpinfo();

      ?>

      :wq! #保存退出

注意:apache默认的程序目录是/var/www/html

权限设置:chown apache.apache -R /var/www/html

至此,CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)教程完成!

end (原文来自于http://www.jb51.net/os/188488.html)

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

注:个别细节原文没提及到

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值