1.安装系统
简易安装
http://www.91linux.com/html/2014/CentOS_0415/9726.html
复杂安装:先创建一张空磁盘再挂在ISO
http://www.centoscn.com/image-text/setup/2013/0816/1263.html

centos: roottoor

2.安装Vmtools
http://jingyan.baidu.com/article/6dad5075ca4d6da123e36e34.html
3.设置固定IP
192.168.1.211
4.安装Apache
默认iptables开启,只在iptables开放了22端口

默认Apache版本

默认安装Apache版本,但是服务没有开启
[root@localhost 桌面]# rpm -qa |grep httpd
httpd-tools-2.2.15-26.el6.centos.i686
httpd-2.2.15-26.el6.centos.i686
[root@localhost 桌面]# service httpd status
httpd 已停
[root@localhost 桌面]# yum search httpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

  • base: mirrors.tuna.tsinghua.edu.cn
  • extras: mirrors.tuna.tsinghua.edu.cn
  • updates: mirrors.tuna.tsinghua.edu.cn
    ============================== N/S Matched: httpd ==============================
    libmicrohttpd-devel.i686 : Development files for libmicrohttpd
    libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
    httpd.i686 : Apache HTTP Server
    httpd-devel.i686 : Development interfaces for the Apache HTTP server
    httpd-manual.noarch : Documentation for the Apache HTTP server
    httpd-tools.i686 : Tools for use with the Apache HTTP Server
    libmicrohttpd.i686 : Lightweight library for embedding a webserver in
    : applications
    mod_auth_mellon.i686 : A SAML 2.0 authentication module for the Apache Httpd
    : Server
    mod_dav_svn.i686 : Apache httpd module for Subversion server
    mod_dnssd.i686 : An Apache HTTPD module which adds Zeroconf support

Name and summary matches only, use "search all" for everything.
yum 安装Apache

[root@localhost 桌面]# yum install httpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

  • base: mirrors.tuna.tsinghua.edu.cn
  • extras: mirrors.tuna.tsinghua.edu.cn
  • updates: mirrors.tuna.tsinghua.edu.cn
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package httpd.i686 0:2.2.15-26.el6.centos will be updated
    ---> Package httpd.i686 0:2.2.15-54.el6.centos will be an update
    --> Processing Dependency: httpd-tools = 2.2.15-54.el6.centos for package: httpd-2.2.15-54.el6.centos.i686
    --> Running transaction check
    ---> Package httpd-tools.i686 0:2.2.15-26.el6.centos will be updated
    ---> Package httpd-tools.i686 0:2.2.15-54.el6.centos will be an update
    --> Processing Dependency: libssl.so.10(libssl.so.10) for package: httpd-tools-2.2.15-54.el6.centos.i686
    --> Processing Dependency: libcrypto.so.10(libcrypto.so.10) for package: httpd-tools-2.2.15-54.el6.centos.i686
    --> Running transaction check
    ---> Package openssl.i686 0:1.0.0-27.el6 will be updated
    ---> Package openssl.i686 0:1.0.1e-48.el6_8.3 will be an update
    --> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
httpd i686 2.2.15-54.el6.centos updates 833 k
Updating for dependencies:
httpd-tools i686 2.2.15-54.el6.centos updates 79 k
openssl i686 1.0.1e-48.el6_8.3 updates 1.5 M

Transaction Summary

Upgrade 3 Package(s)

Total download size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): httpd-2.2.15-54.el6.centos.i686.rpm | 833 kB 00:00
(2/3): httpd-tools-2.2.15-54.el6.centos.i686.rpm | 79 kB 00:00
(3/3): openssl-1.0.1e-48.el6_8.3.i686.rpm | 1.5 MB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 3.3 MB/s | 2.4 MB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) centos-6-key@centos.org
Package: centos-release-6-4.el6.centos.10.i686 (@anaconda-CentOS-201303020136.i386/6.4)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : openssl-1.0.1e-48.el6_8.3.i686 1/6
Updating : httpd-tools-2.2.15-54.el6.centos.i686 2/6
Updating : httpd-2.2.15-54.el6.centos.i686 3/6
Cleanup : httpd-2.2.15-26.el6.centos.i686 4/6
Cleanup : httpd-tools-2.2.15-26.el6.centos.i686 5/6
Cleanup : openssl-1.0.0-27.el6.i686 6/6
Verifying : httpd-2.2.15-54.el6.centos.i686 1/6
Verifying : openssl-1.0.1e-48.el6_8.3.i686 2/6
Verifying : httpd-tools-2.2.15-54.el6.centos.i686 3/6
Verifying : openssl-1.0.0-27.el6.i686 4/6
Verifying : httpd-tools-2.2.15-26.el6.centos.i686 5/6
Verifying : httpd-2.2.15-26.el6.centos.i686 6/6

Updated:
httpd.i686 0:2.2.15-54.el6.centos

Dependency Updated:
httpd-tools.i686 0:2.2.15-54.el6.centos openssl.i686 0:1.0.1e-48.el6_8.3

Complete!

开机启动Apache
chkconfig --list | grep httpd

[root@localhost 桌面]# chkconfig --list |grep httpd
httpd 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭

chkconfig httpd on  设置httpd每次开机自己启动,但并不现在就启动。运行级别2345都为on
service httpd start     现在启动httpd服务,但是下次开机不会自动启动

[root@localhost 桌面]# chkconfig --list |grep httpd
httpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
service httpd status
[root@localhost 桌面]# service httpd status
httpd (pid 3346) 正在运行...
iptables中开放80端口
此时只能虚拟机本机访问80端口,因为iptables中没有开放80端口
此时iptables的运行级别2345都是on
关闭iptables
关闭命令: service iptables stop
永久关闭防火墙:chkconfig iptables off
查看iptables状态 :service iptables status

查看当前iptables状态iptables -L -nservice iptables status默认iptables中只开放了22端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save  或者 service iptables save #保存配置
/etc/rc.d/init.d/iptables restart 或者 service iptables restart #重启服务成功

5.安装MySQL
http://www.centoscn.com/mysql/2014/1211/4290.html
http://blog.csdn.net/xinxin19881112/article/details/46873811
http://www.linuxidc.com/Linux/2015-01/111413.htm
http://blog.csdn.net/xxd851116/article/details/22947891

安装检查
rpm -qa |grep mysql
yum list installed | grep mysql

[root@localhost 桌面]# rpm -qa |grep mysql
mysql-libs-5.1.66-2.el6_3.i686
[root@localhost 桌面]# yum list installed | grep mysql
mysql-libs.i686 5.1.66-2.el6_3 @anaconda-CentOS-201303020136.i386/6.4

安装命令
yum install mysql
yum install mysql-server
yum install mysql-devel
(yum -y install mysql-server mysql mysql-devel)
安装过程没有出现输入用户名密码的地方,也没有远程访问的设置安装成功后检查

[root@localhost 桌面]# rpm -qa |grep mysql
mysql-libs-5.1.73-7.el6.i686
mysql-devel-5.1.73-7.el6.i686
mysql-5.1.73-7.el6.i686
mysql-server-5.1.73-7.el6.i686
[root@localhost 桌面]# yum list installed | grep mysql
mysql.i686 5.1.73-7.el6 @base
mysql-devel.i686 5.1.73-7.el6 @base
mysql-libs.i686 5.1.73-7.el6 @base
mysql-server.i686 5.1.73-7.el6 @base
开机启动MySQL
service mysqld status
chkconfig --list | grep mysqld
chkconfig mysqld on
service mysqld start

查看端口:netstat -tnlp,显示3306 已经开启
查看iptables开放端口:service iptables statusptables中添加3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save  或者 service iptables save #保存配置
/etc/rc.d/init.d/iptables restart 或者 service iptables restart #重启服务

[root@localhost 桌面]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
7 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination

MySQL设置
用户名:root
密码: toorroot 可以空密码登陆
匿名账户也可以登陆
设置root密码

mysql -u root root空密码登陆
select user,host,password from mysql.user; 查看用户信息

设置root用户的密码
set password for root@localhost=password ('在这里填入root密码');
set password for root@127.0.0.1=password ('在这里填入root密码');
set password for root@localhost.localdomain=password ('在这里填入root密码'); 绿色的是主机名

匿名账户登录删除匿名账户登录

删除匿名登录账号
delete from mysql.user where user='';
刷新
flush privileges;

允许远程连接

CREATE USER 'root'@'%' IDENTIFIED BY '您的密码'; ← 增加root用户指定可以任意IP登录,如果想限制只能让指定IP登录请把%替换成IP地址

GRANT ALL PRIVILEGES ON * . * TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; ← 给新添加的root增加权限

刷新
flush privileges;

Navicat 连接成功

6.安装php
安装前检查
rpm -qi php
rpm -qi | grep php
默认没有安装php

yum search all php搜索所有扩展安装php和扩展
yum install php (没有安装php-devel)

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php i686 5.3.3-48.el6_8 updates 1.1 M
Installing for dependencies:
php-cli i686 5.3.3-48.el6_8 updates 2.2 M
php-common i686 5.3.3-48.el6_8 updates 531 k

Transaction Summary

Install 3 Package(s)

Total download size: 3.9 M
Installed size: 13 M

重启apache使php生效  /etc/init.d/httpd restart或者service httpd restart

测试php安装是否成功

    此时可以在目录:/var/www/html/下建立一个PHP文件
代码:

<?php phpinfo(); ?>

成功安装php扩展yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
按自己需求安装扩展(yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt php-mbstring php-bcmath php-mhash libmcrypt libmcrypt-devel)
安装完成

重启apache使php生效 /etc/init.d/httpd restart或者service httpd restart

<?php
$test=mysql_connect("localhost","root","toor");
if($test){
echo 'OK';}
else{
echo 'NO OK';
}
?>

访问此文件成功
<?php
$servername = "localhost";
$username = "root";
$password = "toor";

// 创建连接
$conn = new mysqli($servername, $username, $password);

// 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
echo "连接成功";
?>

访问此文件成功
  1. 安装phpmyadmin
    8.Apache 配置
    /etc/httpd/conf 中httpd.conf

ServerRoot "/etc/httpd" 配置文件位置
Listen 80 监听端口
DocumentRoot "/var/www/html" 访问目录

目录访问权限
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

DirectoryIndex index.html index.html.var

AccessFileName .htaccess

.htaccess

转载于:https://www.cnblogs.com/lnxcode/p/11139190.html

CentOS 6 手动配置Lamp相关推荐

  1. CentOS下如何配置LAMP环境

    目前世界最流行的企业建站方式是LAMP(Linux+Apache+MySQL+PHP),即使用Linux作为操作系统,Apache作为Web服务器,MySQL作为数据库,PHP作为服务器端脚本解释器. ...

  2. CentOS 6.4 配置LAMP 环境 与安装 phpmyadmin

    参考的博客原文看这里,自己加了些东西 ---------------------------------安装LAMP 环境: 首先测试一下 yum install httpd 这个命令,如果能够正常安 ...

  3. CentOS 7 学习(一) 配置LAMP和Nginx

    CentOS 7 学习(一) 配置LAMP和Nginx CentOS是RedHat Linux企业版的代码编译版本,属于比较通用的服务器Linux版本,据说Ubuntu Server更通用,呵呵,不过 ...

  4. CentOS 7.0服务器安装配置LAMP服务器

    这篇文章主要介绍了CentOS 7.0服务器安装配置LAMP服务器(Apache+PHP+MariaDB),需要的朋友可以参考下 准备篇: CentOS 7.0系统安装配置图解教程 //www.iis ...

  5. wamp安装和配置_手动配置Wordpress环境真香,让我毫不犹豫卸载LAMP和WAMP环境

    作为一名Java开发者,我平时也喜欢学习除Java以外的其他技术,例如PHP(有人说PHP是最好的编程语言,我无心考究).对于任何一个开发者,在学习一门新的编程语言过程中,首先都会面对配置开发环境这样 ...

  6. CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)

    2019独角兽企业重金招聘Python工程师标准>>> 准备篇: 1.配置防火墙,开启80端口.3306端口    vi /etc/sysconfig/iptables    -A ...

  7. CentOS 7.0系统安装配置LAMP服务器(Apache+PHP+MariaDB)

    CentOS 7.0接触到的用户是比较少的,今天看了站长写了一篇关于centos7中安装配置LAMP服务器的教程,下面我把文章稍加整理一下转给大家学习交流,希望例子能给各位带来帮助哦. centos7 ...

  8. CentOS 6.3安装配置LAMP服务器(Linux+Apache+MySQL+PHP5)

    服务器系统环境:CentOS 6.3 客户端系统环境:Windows 7 ultimate(x86)sp1 简体中文旗舰版 ※ 本文档描述了如何在Linux服务器配置Apache.Mysql.PHP5 ...

  9. Linux系统中手动配置IP地址(CentOS 7、8为例)

    第一步:进入网卡配置目录 [root@huyuxuan /]# cd /etc/sysconfig/network-scripts [root@huyuxuan network-scripts]# l ...

最新文章

  1. 深入.NET 4.0之,LazyT点滴
  2. ❤️ 爆肝一个月!JAVA零基础入门总结(上)❤️
  3. 强悍的 Ubuntu —— 粘贴板
  4. (centos6.5)MySQL服务安装
  5. php中的几个判断文件和目录的函数 is_file() is_dir() mkdir() file_exists()
  6. 从面试官甄别项目经验的角度,说说如何在简历中写项目经验(java后端方向)
  7. 谷歌浏览器提示Flash版本过低,要求更新或运行一次
  8. conda安装requirement.txt指定的依赖包
  9. antDesignPro大坑 Maxium call stack size exceeded
  10. 如何理解惯性问题,是物理学的大问题
  11. tomcat7的下载和安装配置
  12. 逻辑归纳与数学归纳:皮亚诺公理5解读1——皮亚诺读后之七
  13. 蒲公英内测托管平台是干什么的?
  14. 渗透工具之CS4.0使用说明书
  15. TradingView--Charting Library是什么
  16. numpy PIL tensor之间的相互转换
  17. skb_copy和skb_clone对比
  18. 领扣LintCode算法问题答案-1438. 较大分组的位置
  19. 计算机组成原理课程实验报告,计算机组成原理课程设计实验报告
  20. 与人交往的基本礼仪!

热门文章

  1. MusicHub -- 三合一(qq、xiami、网易云) 音乐搜索
  2. IT 运维服务规范 | 资料
  3. 注册商标的价值及保护方案有哪些
  4. 【quote】free HRTF Databases available on-line
  5. 基于AutoJs实现的薅羊毛专业版又一次大更新
  6. 热门软件看点:IE和它的对手们
  7. 数据压缩 实验三 Huffman编解码算法实现与压缩效率分析
  8. My New Mouse
  9. 【oracle存储过程】实现生成等额本息的还款计划
  10. Markdown语法链接通过新窗口打开解决办法