美文网首页
Cen OS6 系统下安装LAMP

Cen OS6 系统下安装LAMP

作者: 冰泪 | 来源:发表于2017-07-07 09:27 被阅读0次

一、个别电脑可能有防火墙限制导致不能安装

查看防火墙关闭状态service iptables status

1关闭防火墙-----service iptables stop

2启动防火墙-----service iptables start

3重启防火墙-----service iptables restart

4查看防火墙状态--service iptables status

5永久关闭防火墙--chkconfig iptables off

6永久关闭后启用--chkconfig iptables on

二、开始安装MySQL

1、安装

#  yum install  mysql mysql-server

2 、设置mysql 开机自启动

#  chkconfig--levels 235 mysqld  on  /etc/init.d/mysqld start

3、设置mysql密码

   1>知道初始密码  通过登录mysql系统,

# mysql -u root -p  password:

【输入原来的密码】

# use mysql;

# update user set password=password("test") where user='root';

#  flush privileges;

#  exit;

   2>忘记原来的myql的root的密码;

查看下mysql状态

# /etc/init.d/mysqld status

如果正在运行状态下 那么请首先关闭掉

# /etc/init.d/mysqld stop然后

跳过验证

# mysqld_safe --skip -grant -tables

这时已经跳过验证直接 进入mysql

# mysql

进入mysql系统数据库:

# use mysql

修改root账户密码:

# update user set password=password("12345") where user="root";

刷新权限:

# flush privileges;

退出

# exit启动mysql:

# /etc/init.d/mysqld start

进入mysql

# mysql -u root -p 12345

三、安装Apache2

1、安装

# yum install  httpd

2配置系统在引导时启动

# chkconfig--levels 235 httpd on

3、启动Apache

#  /etc/init.d/httpdstart

然后浏览器输入 http://127.0.0.1或者 服务器的域名    你应该看到Apache2的测试页:

注意

Apache的默认文档根目录是在CentOS上的/var/www/html 目录 ,

配置文件是/etc/httpd/conf/httpd.conf

四、安装PHP

1我们可以用下面的命令来安装PHP  php55w 表示安装php5.5版本 根据自己需求更改

# yum install php55w

安装完需要重启

# /etc/init.d/httpd restart

测试在根目录中创建

# vi /var/www/html/info.php

然后浏览器访问例如http://127.0.0.1/info.php  或者http://域名/index.php显示index.php 内容就表示完成了

设置php mysql支持  安装的php-mysql软件

# yum install  php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xmlphp-xmlrpc

重新启动Apache2的:

# /etc/init.d/httpd restart

五、安装phpMyAdmin(注意下载的phpMyAdmin 支持的php 版本 和mysql版本)

下载phpMyAdmin 文件 然后将文件包放在 /var/www/html文件夹下如果php环境没问题的话应该能通过http://127.0.0.1/phpMyAdmin/访问了 内部具体的权限设置可以自行查阅资料

六、错误解决方法

1、出现缺少包的错误解决方法

查看以下的包是不是全部安装完成

httpd    httpd-devel    php55w    php55w-devel     php55w-mysql    mysqld-server   mysql    mysql-server

如果缺少那个重新安装那个

一键安装所需的所有包(php55w 是php5.5 版本具体根据自己使用版本而定)

使用前先移除服务器上的各种包

#  yum -y remove httpd httpd-devel php55w php55w-devel php55w-mysql mysqld55w-server mysql55w mysql55w-server

安装

#  yum -yinstall httpd httpd-devel php55w php55w-devel php55w-mysql mysqld55w-servermysql55w mysql55w-server

2、出现 yum安装出现 Error: xz compression not available

解决方法:

参考这个帖子https://my.oschina.net/iceTear/blog/1162681

3、phpMyAdmin里边出现 没有找到 PHP 扩展 mbstring,而您现在正在使用多字节字符集。

解决方法:

#  yuminstall php55w-mbstringphp -m 可以查看当前php 支持的扩展

4、phpMyAdmin 配置文件现在需要一个短语密码。

解决方法:

1、将 phpMyAdmin/libraries/config.default.php中的$cfg['blowfish_secret'] =''; 改成 $cfg['blowfish_secret'] ='aaaaa'; (注:其中的'aaa′为随意的32位字符 否则会警告太短)

2、在phpMyAdmin目录中,打开config.inc.php,

$cfg['blowfish_secret'] = ''; 改成 $cfg['blowfish_secret'] = 'aaaaa'; (注:其中的'aaaaa′为随意的字符)这个密码用于Cookies的加密,以免多个PhpMyAdmin或者和其他程序共用Cookies时搞混。

5、重启apach服务器出现下面警告

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName

解决方法:

#  echo"ServerName admin">>/etc/httpd/conf/httpd.conf

给服务器设置个名字即可

6、由于端口受限 不能访问的 参考以下帖子 开启端口的方法

http://www.jianshu.com/writer#/notebooks/11663044/notes/14293774

相关文章

  • Cen OS6 系统下安装LAMP

    一、个别电脑可能有防火墙限制导致不能安装 查看防火墙关闭状态service iptables status 1关闭...

  • CentOS 6.3编译安装LAMP环境笔记

    这篇文章主要介绍了CentOS 6.3编译安装LAMP环境笔记,本文从系统安装讲解,涵盖了系统、LAMP环境的安装...

  • LAMP环境的搭建(二)

    上次安装使用的是源码编译的方式来分别进行LAMP环境。这次主要采用简单的yum安装方式。 实验环境:虚拟机 cen...

  • Ubuntu系统下安装LAMP环境

    登陆到Ubuntu的命令行环境下: 首先要先更新Ubuntu的apt-get的软件资源信息:$ sudo apt-...

  • ubuntu18.04 lamp搭建

    ubuntu 系统 lamp搭建 安装apache 安装mysql 安装PHP 主要文件位置(默认安装) ubu...

  • 手机短信验证功能实战开发

    开发环境准备 本功能以LAMP为开发环境,请确保电脑上已安装LAMP,具体安装过程参见ubuntu下 LAMP的安...

  • Linux 基础回顾及运行环境检查

    网络检查: 查看当前网络运行环境 系统环境检查: 软件包安装检查: Ubuntu系统: Debian系统: Cen...

  • Ubuntu搭建LAMP环境

    1.安装系统时选择LAMP服务,系统安装好,Apache2,PHP,MySql服务也就安装好了 2.手动安装php...

  • 03.centos7安装Apache

    LAMP:Linux Apache MySQL PHP LAMP就是Linux系统下搭建的Apache,MySQL...

  • centos7 安装LAMP环境

    更新系统 查看系统的版本: 注意:保证安装LAMP的源是可用的,更换源之后,最好 安装apachehttpd / ...

网友评论

      本文标题:Cen OS6 系统下安装LAMP

      本文链接:https://www.haomeiwen.com/subject/itklhxtx.html