当前位置:   article > 正文

Yum安装Apache(2.2)、MySQL(5.5)、PHP(5.4)_yum apache2.2

yum apache2.2

        CentOs装好后,先配置网络,进入 /etc/sysconfig/network-scripts/ifcfg-eth0,把onboot改为on,重启网络service network restart。


        更换Yum源

  1. mv CentOS-Base.repo CentOS-Base.repo.bak
  2. wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
  3. yum makecache
  4. 一定得把以前的 CentOS-Base.repo给删除了,不然在Yum操作的时候就会出现Repository base is listed more than once in the configuration提示信息

        安装Apache

  1. yum install httpd httpd-devel
  2. 安装完成后,用/etc/init.d/httpd start 启动apache
  3. 设为开机启动:chkconfig httpd on

      安装MySQL

  1. wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
  2. rpm -ivh mysql57-community-release-el7-7.noarch.rpm
  3. vim /etc/yum.repos.d/mysql-community.repo
  4. 把MySQL 5.5的enable改为1,其他版本的改为0
  5. yum install mysql mysql-server mysql-devel
  6. /etc/init.d/mysqld start
  7. 装好后,会出现Access denied for user 'root'@'localhost' (using password: YES),解决方法如下
  8. /etc/init.d/mysqld stop
  9. mysqld_safe –skip-grant-tables &
  10. mysql -uroot -p
  11. use mysql;UPDATE user SET Password=PASSWORD(123456) WHERE USER='root';flush privileges;quit;
  12. /etc/init.d/mysqld start

        安装PHP

  1. rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
  2. yum install php54w php54w-bcmath php54w-cli php54w-common php54w-devel php54w-fpm php54w-gd php54w-imap php54w-ldap php54w-mbstring php54w-mcrypt php54w-mysql php54w-odbc php54w-pdo php54w-pear php54w-pecl-igbinary php54w-xml php54w-xmlrpc php54w-opcache php54w-intl php54w-pecl-memcache

        重启apache,/etc/init.d/httpd restart,搞定。


        【update】下面是简单虚拟主机配置

  1. #这里要关闭selinux,不然有时会报权限问题
  2. vi /etc/sysconfig/selinux
  3. SELINUX=disabled
  4. reboot
  5. #也可以临时关闭,但重启之后还是会变成原来的状态
  6. setenforce 0
  7. Listen 3029
  8. <VirtualHost *:3029>
  9. DocumentRoot "/var/www/html/sugar"
  10. ServerName localhost
  11. ErrorLog "/var/log/sugar_error.log"
  12. CustomLog "/var/log/sugar_access.log" common
  13. <Directory /var/www/html/sugar>
  14. Options Indexes FollowSymLinks MultiViews
  15. AllowOverride All
  16. Order deny,allow
  17. allow from all
  18. </Directory>
  19. </VirtualHost>
  20. Listen 3030
  21. <VirtualHost *:3030>
  22. DocumentRoot "/var/www/html/test"
  23. ServerName localhost
  24. </VirtualHost>
  25. #如果重启Apache后,没有进入想要的界面,在错误日志里显示 Directory index forbidden by Options directive
  26. rm -f /etc/httpd/conf.d/welcome.conf
  27. rm -f /var/www/error/noindex.html
  28. service httpd restart



声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/669151
推荐阅读
相关标签
  

闽ICP备14008679号