• Centos6.5添加Epel和Remi源安装Lamp环境


    想搭建一个Lamp环境,因为编译安装太麻烦,对于我这样的新手来说,太过于复杂。而CentOS自带的Apache、MySql和PHP的版本都太低,不想用。上百度搜了一轮,原来可以通过添加Epel和Remi源来解决。对于Epel源和Remi源,网友是这样介绍的:

    EPEL源

    EPEL,即Extra Packages for Enterprise Linux,是由 Fedora 社区创建维护,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。EPEL中含有大量的软件,对官方标准源是一个很好的补充。

    “EPEL (Extra Packages for Enterprise Linux ) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).”

    wiki:http://fedoraproject.org/wiki/EPEL

    Fedora EPEL 下载:http://mirrors.fedoraproject.org/publiclist/EPEL/

    EPEL 下载地址:http://download.fedora.redhat.com/pub/epel/

    请针对不同的版本下载相应的包。

    Remi源

    Remi源大家或许很少听说,不过Remi源GoFace强烈推荐,尤其对于不想编译最新版的linux使用者,因为Remi源中的软件几乎都是最新稳定版。或许您会怀疑稳定不?放心吧,这些都是Linux骨灰级的玩家编译好放进源里的,他们对于系统环境和软件编译参数的熟悉程度毋庸置疑。

    Remi下载地址:http://rpms.famillecollet.com/

    您也需要针对不同的版本号下载。(以上介绍为转载)

    yum remove epel-release-6-8.noarch

    以下是安装的过程和命令:

    安装Epel源:

    我本地的CentOS是6.5,所以安装的是对应的版本epel 6

    rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

    然后导入KEY

    rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

    别忘了,还有一步

    yum install yum-priorities

    安装Remi源:

    版本也是对应CentOS6.x的

    rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi

    同样也需要执行以下命令

    yum install yum-priorities

    OK,Epel和Remi源就已经添加了,在/etc/yum.repos.d/中可以看到,已经多了几个文件:

    epel.repo
    epel-testing.repo
    
    remi.php70.repo
    remi.repo

    安装Lamp环境:

    安装Apache

    yum --enablerepo=remi install httpd

    修改防火墙配置

    打开/etc/sysconfig/iptables

    vi /etc/sysconfig/iptables

    在文件中添加:

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT 

    关闭SELINUX
    打开文件

    vi /etc/selinux/config

    将以下两行注释掉并增加SELINUX=disabled:

    #SELINUX=enforcing #注释掉
    #SELINUXTYPE=targeted #注释掉
    SELINUX=disabled #增加

    配置apache2

    编辑apache 配置文件

    sudo vi /etc/httpd/conf/httpd.conf 

    找到 #ServerName www.example.com:80
    修改为 ServerName 这里设置为你自己的域名,如果没有域名,可以设置为localhost:80

    配置开机自动启动apache2

    chkconfig httpd on

    重启CentOS,在浏览器输入localhost应该就能看到'Apache 2 Test Page'页面了。

    安装MySQL

    yum --enablerepo=remi install mysql mysql-server

    安装完毕后,设置开机自动启动,并拷贝配置文件

    chkconfig mysqld on  
    cp /usr/share/mysql/my-medium.cnf /etc/my.cnf 

    启动MySql,会根据配置文件生成一个/var/lib/mysql/mysql.sock文件。如果没有这个文件,是不能登录MySql的。

    为root账户设置密码

    mysql_secure_installation

    然后跟着提示输入就可以了。

    安装PHP5

    yum --enablerepo=remi install php

    再安装如下php组件:

    yum --enablerepo=remi install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt

    修改Apache配置:

    vi /etc/httpd/conf/httpd.conf

    找到DirectoryIndex index.html index.html.var

    修改为:

    DirectoryIndex index.php index.html index.htm Default.html Default.htm

    重启Apache,创建一个php文件测试。

    结束。

  • 相关阅读:
    [STL][C++]MAP
    [原创]南水之源A*(A-Star)算法
    php+mysql模糊查询功能
    php中如何传递Session ID
    初识jsonp
    跨站脚本攻击XSS
    XSS危害——session劫持
    PHP中获取当前页面的完整URL
    smarty获得当前url的方法分享
    表空间的管理方式有哪几种,各有什么优劣?
  • 原文地址:https://www.cnblogs.com/mityaya/p/4672312.html
Copyright © 2020-2023  润新知