概述
一、实验拓扑
环境描述:
客户端:无任何系统的裸金属机器
DNS:192.168.10.10/24 提供DNS域名解析(15分)
PXE:192.168.10.20/24 提供DHCP,TFTP,FTP功能,DHCP地址范围(192.168.10.100/24-192.168.10.200/24)
网关可用ENSP中路由或者是Linux服务器替代(内网口:192.168.10.1/24;外网口:12.0.0.1/24)
LAMP:12.0.0.12/24 提供web论坛服务,且Apache的网站站点由NFS提供,不使用本地存储空间。
NFS:12.0.0.13/24 提供共享存储空间,共享目录名为share。
需求:完成所有服务构建,给客户机自动部署Linux系统,且该客户机拥有系统后可以使用www.kgc.com直接可以访问LAMP服务器中的论坛。
二、具体配置
2.1网关路由器:双网卡
ens33:12.0.0.1
ens36:192.168.10.1
做路由转换
2.2DNS域名解析服务器
1.yum -y install bind bind-utils bind-libs bind-chroot
2.vi /etc/named.conf
3.vi /etc/named.rfc1912.zones
4.cd /var/named
chown named:named kgc.com.zone ##更改权限
验证:
2.3NFS共享服务器
服务器端:
1.安装压缩包
yum -y install nfs-utils
yum -y install rpcbind
2.设置开机自启
systemctl enable nfs
systemctl enable rpcbind
3.创建共享目录
mkdir -p /opt/share
4.开启共享服务
systemctl start nfs
systemctl start rpcbind
5.查看进程
yum -y install net-tools
netstat -anpt | grep rpc
lamp端:
systemctl restart rpcbind
systemctl enable rpcbind
挂载
永久挂载
2.4LAMP架构
1.Apache安装
tar zxvf apr-1.6.2.tar.gz
tar zxvf apr-util-1.6.0.tar.gz
tar jxvf httpd-2.4.29.tar.bz2
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
yum -y install gcc gcc-c++ make pcre-devel expat-devel perl
cd httpd-2.4.29/
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
make
make install
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
#chkconfig: 35 85 21
#description:Apache is a World Wide Web server
chkconfig --add httpd
chkconfig --list
cd /usr/local/httpd/conf
vi httpd.conf
ServerName www.kgc.com:80
Listen 12.0.0.12:80
#Listen 80
ln -s /usr/local/httpd/conf/httpd.conf /etc/
ln -s /usr/local/httpd/bin/* /usr/local/bin/
httpd -t
iptables -t nat -F
systemctl restart httpd
2.MYSQL安装
yum -y install ncurses-devel autoconf cmake
cd /opt
tar zxvf mysql-5.6.26.tar.gz
cd mysql-5.6.26/
cmake
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DSYSCONFIDIR=/etc
-DMYSQL_DATADIR=/home/mysql/
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock
make -j3
make install
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
cd /etc/init.d
chmod 755 mysqld
chkconfig --add /etc/init.d/mysqld
chkconfig mysqld --level 35 on
chkconfig --list
echo “PATH=$PATH:/usr/local/mysql/bin” >> /etc/profile
source /etc/profile
echo $PATH
useradd -s /sbin/nologin mysql
chown -R mysql.mysql /usr/local/mysql/
/usr/local/mysql/scripts/mysql_install_db --user=mysql --ldata=/var/lib/mysql --basedir=/usr/local/mysql --datadir=/home/mysql
vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/home/mysql
service mysqld start
netstat -anpt | grep 3306
mysqladmin -uroot -p password “abc123”
mysql -uroot -p
3、php安装
yum -y install gd libpng libpng-devel pcre pcre-devel libxml2-devel libjpeg-devel
tar jxvf php-5.6.11.tar.bz2
cd php-5.6.11
./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5 --enable-mbstring
make
make install
cp -r php.ini-development /usr/local/php5/php.ini
ln -s /usr/local/php5/bin/* /usr/local/bin/
vi /etc/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
httpd -t
vi /usr/local/httpd/htdocs/index.php
systemctl restart httpd
测试 http://12.0.0.12/index.php
4.配置bbs数据库、授权
mysql> create database bbs;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on bbs.* to ‘bbsuser’@’%’ identified by ‘admin123’;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on bbs.* to ‘bbsuser’@‘localhost’ identified by ‘admin123’;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
5.准备论坛安装包
cd /opt
unzip Discuz_X3.4_SC_UTF8.zip
cp -r upload/* /usr/local/httpd/htdocs
cd /usr/local/httpd/htdocs
chown -R daemon ./config
chown -R daemon ./data
chown -R daemon ./uc_client/
chown -R daemon ./uc_server/data/
5.安装论坛
2.5PXE批量装机服务器
ftp服务
root@localhost ~]# mkdir -p /var/ftp/centos7
[root@localhost ~]# mount /dev/cdrom /mnt
[root@localhost ~]# cp -rf /mnt/* /var/ftp/centos7
[root@localhost ~]# yum -y install vsftpd
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# systemctl enable vsftpd
tftp服务
[root@localhost ~]# yum -y install tftp-server
[root@localhost ~]# vi /etc/xinetd.d/tftp
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl enable tftp
准备 Linux 内核、初始化镜像文件
[root@localhost ~]# cd /mnt/images/pxeboot/
[root@localhost pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/
准备 PXE 引导程序
[root@localhost ~]# yum -y install syslinux
[root@localhost pxeboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
安装并启用 DHCP 服务
[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# vi /etc/dhcp/dhcpd.conf
[root@localhost ~]# systemctl start dhcpd
[root@localhost ~]# systemctl enable dhcpd
配置启动菜单文件
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@localhost ~]# vi /var/lib/tftpboot/pxelinux.cfg/default
2.6验证
回车
进入此界面配置
安装完成后打开网页www.kgc.com 直接显示论坛页面
最后
以上就是搞怪指甲油为你收集整理的linux小型架构服务部署——DNS+PXE自动装机+LAMP架构+NFS一、实验拓扑二、具体配置的全部内容,希望文章能够帮你解决linux小型架构服务部署——DNS+PXE自动装机+LAMP架构+NFS一、实验拓扑二、具体配置所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复