第二十天 centos7的lamp简单实现

博客作业:CentOS 7 lamp,

vhost1: pma.stuX.com, phpMyAdmin, 同时提供https服务;

vhost2: wp.stuX.com, wordpress

vhost3: dz.stuX.com, Discuz


环境说明:

DNS是:192.168.100.7

vhosts(Centos7):192.168.100.100

测试电脑是:192.168.100.1,DNS指定192.168.100.7


一、编译安装bind9

先创建一个系统帐号useradd -r named  (gruoadd -g 53 named; useradd -u 53 -g named named -r )   
 ./configure  --prefix=/usr/local/bind9 --sysyconfdir=/etc/named --disable-ipv6 --disablie-chroot --enable-threads
make
make install
编辑PATH  export PATH=/usr/local/bind9/bin:/usr/local/bind/sbin:$PATH---->创建一个文件在,在/etc/profile.d目录下
vim /etc/ld.so.conf.d/named.conf ---->/usr/local/bind9/lib   编辑库文件
ldconfig -v 导出库文件
ln -sv /usr/local/bin9/inclue /usr/include/named  头文件
vim /etc/man.config---->MANPATH /usr/local/bind9/share/man 导出帮助搜索路径
vim /etc/named.conf主配置文件
创建/var/named目录的各文件:named.ca  named.localhost  named.loopback

blob.png

完成后使用named -u -f -g -d 3启动named服务,并显示调试信息

blob.png


二、  在centos7上检查lamp环境

blob.png

 测试PHP与mraiadb的连通性

blob.png

blob.png

blob.png

blob.png


三、创建httpd的虚拟机

 在主配置文件/etc/httpd/conf/httpd.conf中最后插一行,指定虚拟机的配置文件及路径

blob.png

虚拟机的配置如下:

blob.png

 虚拟机的index.html如下:   

[root@localhost www]# cat vhost1/index.html  vhost2/index.html vhost3/index.html 
welocomm to pma.stux.com
welcomm to wp.stux.com
welcomm to dz.stux.com
[root@localhost www]#

          测试虚拟机

blob.png


四  pma.stux.com启用https

     centos6(192.168.100.7)做为ca,centos7(192.168.100.100)将向centos6申请签证证书

centos6(192.168.100.7)上关于的CA的配置:
(umask 077;openssl genrsa -out /etc/pki/CA/privaite/cakey.pem 2048) 生成密钥
openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 300 -out /etc/pki/CA/cacert.pem  自签密钥
touch /etc/pki/CA/index.txt 
echo 01 > serial

      centos7的密钥配置:

(umask 077;openssl genrsa -out /mnt/pma.stux.com.key 2048)
openssl req -new -key /mnt/pma.stux.com -days 300 -out /mnt/pma.stux.com.csr

     把centos 7上的pma.stux.com.csr传给CA服务器(centos6),并进行签证

传给centos6可以使用scp命令
scp /mnt/pma.stux.com.csr 192.168.100.7:/mnt
 
centos6签证
openssl ca -in /mnt/pma.stux.com.csr /mnt -days 300 -out /mnt/pma.stux.com.crt
scp /mnt/pma.stux.com.crt 192.168.100.100:/mnt

  centos7检查mod_ssl模块是否已安装 

blob.png

     centos7上启用配置ssl

把/mnt目录下的pma.stux.com.key pma.stux.com.csr pma.stux.crt移动的/etc/httpd/ssl目录下

    修改/etc/httpd/con.d/ssl.conf配置

blob.png

blob.png

    使用httpd -t 检查配置,并重启httpd服务

[root@localhost conf.d]# httpd -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set
 the 'ServerName' directive globally to suppress this messageSyntax OK
[root@localhost conf.d]#

    测试

blob.png


    五、把vhost2:wp.stux.com目录安装wordpress     

[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 5.5.44-MariaDB MariaDB Server
 
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 
MariaDB [(none)]> UPDATE mysql.user SET Password = password('123456') where User='root'; \\修改mysql的root密码是123456
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0
 
MariaDB [(none)]> CREATE DATABASE wordpress; \\创建wordpress库
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]> SHOW DATABASES
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| wordpress          |
+--------------------+
5 rows in set (0.00 sec)
 
MariaDB [(none)]> GRANT ALL ON wrodpress.* TO 'root'@'localhost' IDENTIFIED BY '123456'; \\以root用户连接数据库
MariaDB [(none)]> GRANT ALL ON wrodpress.* TO 'root'@'localhost' IDENTIFIED BY '123456'
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> EXIT
Bye

    下载wordpress、解压,并把解压后的文件复制到/www/vhost2目录下

blob.png

    把文件wp-config-sample.php重命名为wp-config,并修改

    blob.png

        打开wp.stux.com/wp-config.php

blob.png

 blob.png


    六、在vhost3(dz.stux.com)安装Discuz

    下载 Discuz并解压,完成后文件复制到/www/vhost3

    blob.png

    在浏览器上打开dz.stux.com/reload/install.php

blob.png

      把upload目录下的/config/、/data/、/uc_client/data、/uc_server/data权限设置为777,否则安装是提示错误

blob.png

blob.png

blob.png

   

原创文章,作者:Net20-deamon,如若转载,请注明出处:http://www.178linux.com/18617

(0)
Net20-deamonNet20-deamon
上一篇 2016-06-18
下一篇 2016-06-19

相关推荐

  • linux 学习之权限优先级

    linux下对同一文件的权限分成很多类,同时也可能对同一文件权限配置多种权限那么在这么多配置中,到底是怎么生效的呢?比如一个文件abc.txt属于wang用户,而同时对abc.txt又设置了ACL禁止 wang用户读写执行等等这些情况就是ACL的生效顺序完全理解,模拟出实验环境一一验证1,文件a属于mage用户,但ACL限制 mage读写执行 Paste_I…

    Linux干货 2017-05-29
  • Lvm基本应用,扩展及缩减实现

    什么是LVM LVM是Logical Volume Manager的简写。其是Linux环境下对磁盘分区进行管理的一种机制。LVM由Heinz Mauelshagen在Linux 2.4内核上实现。其主要作用是在不损坏磁盘数据的情况下对磁盘空间进行增加,缩减。LVM的做法是将几块物理硬盘通过软件的方式组合成一块空间相对大的Volume Group,简称VG,…

    Linux干货 2016-09-08
  • N25 _WSH 第二周

    2、bash 命令执行的状态结果:        * bash通过状态返回值来输出此结果:            * 成功:0            失败:1-255     &n…

    系统运维 2016-12-12
  • GRUB——防止root密码被破解

    GRUB(Boot Loader): ·grub:GRand Unified Bootloader          grub 0.x:grub leagacy          grub 1.x:g…

    Linux干货 2016-09-11
  • ssh基于密钥的认证及实现

    ssh登录认证方式介绍 大致有以下两种 基于口令的认证这种认证方式就是通过ssh指令以指定用户名、指定端口等信息后,待连接建立完成,需要输入用户名对应的口令来完成认证。一般形如: [root@localhost ~]# ssh -l lantian 192.168.1.201  &nbsp…

    Linux干货 2017-01-05
  • 网络管理及其一些网络协议

    1,这周我们主要学的是有关网络的相关知识;下面我就介绍一下我感觉重要的一些内容。 首先介绍的是计算机网络协议的七层模型:从上到下依次分为:7,应用层(application):OSI模型的第七层,负责为操作系统或网络应用程序提供访问网络服务的接口。                …

    2017-09-02