技术流ken

运维拯救世界

DAY8:课堂记录LAMP架构和cobbler–技术流ken

 

LAMP架构

 

Linux+apache+mariadb/mysql+php

 

第一步:下载LAMP相关软件

[root@ken2 ~]# yum install mariadb-server httpd php php-mysql -y

 

第二步:启动httpd和mariadb

[root@ken2 ~]# systemctl restart httpd mariadb

[root@ken2 ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *:3306 *:*
LISTEN 0 511 *:80 *:*

 

第三步:上传wordpress

[root@ken2 html]# mv wordpress/* .
[root@ken2 html]# ls
index.php wp-admin wp-cron.php wp-pass.php
license.txt wp-app.php wp-includes wp-register.php
readme.html wp-blog-header.php wp-links-opml.php wp-settings.php
wordpress wp-comments-post.php wp-load.php wp-signup.php
wordpress-3.3.1-zh_CN.zip wp-config-sample.php wp-login.php wp-trackback.php
wp-activate.php wp-content wp-mail.php xmlrpc.php
[root@ken2 html]# cp wp-config-sample.php wp-config.php

 

第四步:修改样板文件

define(‘DB_NAME’, ‘ken’);   #数据库名

/** MySQL 数据库用户名 */
define(‘DB_USER’, ‘ken’);     #用户名

/** MySQL 数据库密码 */
define(‘DB_PASSWORD’, ‘123’);   #数据库密码

 

 

第五步:创建数据库和用户

MariaDB [(none)]> create database ken;

MariaDB [(none)]> grant all on *.* to ken@’localhost’ identified by ‘123’;

 

第六步:浏览器访问

IP

 

 

编译安装httpd管理

 

apachectl在任意目录下面使用需要配置如下:

[root@ken1 ~]# cat /etc/profile.d/httpd.sh
export PATH=/usr/local/httpd2.4/bin:$PATH

 

注意:建议编译安装的  apache命令路径写在前面!

 

 

VIrtualhost配置

 

<Directory “/var/www/ken1”>

 

 

VIrtualhost配置–域名

 

第一步:编写virtualhost

<virtualhost 192.168.163.5>
documentroot /var/www/ken1
servername www.ken.com
directoryindex index.html
</virtualhost>

 

第二步:重启httpd

[root@ken1 ken1]# apachectl restart

 

第三步:域名解析

[root@ken1 ken1]# vim /etc/hosts

192.168.163.5 www.ken.com

 

第四步:curl命令

[root@ken1 ken1]# curl www.ken.com
test

 

第五步:window验证

无法访问

 

第六步:window做域名解析

C:\Windows\System32\drivers\etc\hosts

 

第七步:浏览器访问

可以访问了

 

 

centos7系统启动流程

 

1. bios初始化开始开机自检

检查内存,CPU,磁盘等硬件

 

2.加载MBR到内存

512字节

前446字节:bootloader

64字节:分区表

2字节:魔数55AA

 

3. GRUB阶段

 

4.加载内核和虚拟内存

 

5.systemd服务接管

 

 

cobbler部署详解

 

第一步:下载相关软件

[root@ken1 ken1]# yum install httpd cobbler tftp xinetd syslinux dhcp -y

 

第二步:配置DHCP服务

subnet 192.168.11.0 netmask 255.255.255.0 {
range 192.168.11.10 192.168.11.20;
default-lease-time 600;
max-lease-time 7200;
filename “pxelinux.0”;
}

 

第三步:重启dhcp

[root@ken1 ken1]# systemctl restart dhcpd

 

第四步:开启tftp

[root@ken1 ken1]# vim /etc/xinetd.d/tftp

disable = no

 

第五步:重启xinetd

[root@ken1 ken1]# systemctl restart xinetd

 

第六步:重启httpd

[root@ken1 ken1]# systemctl restart httpd

 

第七步:重启cobbler

[root@ken1 ken1]# systemctl restart cobblerd

 

遇到如下错误:

httpd does not appear to be running and proxying cobbler, or SELinux is in the way.

 

一:没有启动httpd

二:selinux没有关

getenforce

setenforce 0

vim /etc/sysconfig/selinux

 

第八步:需要检测cobbler配置

[root@ken1 ken1]# cobbler check
The following are potential configuration items that you may want to fix:

1 : The ‘server’ field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the ‘next_server’ field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders’ to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The ‘cobbler get-loaders’ command is the easiest way to resolve these requirements.
4 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : ksvalidator was not found, install pykickstart
7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to ‘cobbler’ and should be changed, try: “openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here'” to generate new one
8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run ‘cobbler sync’ to apply changes.

 

第九步:修改检查出来的问题进行一一修改

[root@ken1 ken1]# vim /etc/cobbler/settings

第一个:server

server: 192.168.11.143

 

第二个:next_server

next_server: 192.168.11.143

 

第三个:不需要修改

 

第四个:启动rsyncd服务

[root@ken1 ken1]# systemctl restart rsyncd
[root@ken1 ken1]# systemctl enable rsyncd

 

第:5.6.8都不需要修改

 

第七个:

[root@ken1 ken1]# openssl passwd -1 -salt “456” “123”
$1$456$8qEEwNJs7cZWkT5n3jFUF0
[root@ken1 ken1]# vim /etc/cobbler/settings

default_password_crypted: “$1$456$8qEEwNJs7cZWkT5n3jFUF0″

 

第八步:重启cobbler

[root@ken1 ken1]# systemctl restart cobblerd

 

第九步:再次cobbler检查

 

第十步:cobbler配置更新

[root@ken1 ken1]# cobbler sync

 

第十一步:开始制作镜像

[root@ken1 ken1]# mount /dev/cdrom /mnt

[root@ken1 ken1]# cobbler import –path=/mnt –name=”centos7.5″

 

 

这里速度会稍慢!

 

第十二步:查看生成的镜像

[root@ken1 ken1]# cobbler distro list
centos7.5-x86_64

[root@ken1 ken1]# cobbler profile list
centos7.5-x86_64

 

第十三不:准备kickstart文件

[root@ken1 ~]# cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg

url –url=http://192.168.11.143/cobbler/ks_mirror/centos7.5/

 

第十四步:制作profile文件

[root@ken1 ~]# cobbler profile add –kickstart=/var/lib/cobbler/kickstarts/ks.cfg –distro=centos7.5-x86_64 –name=”centos7.5_ken”

 

第十五不:查看profile

[root@ken1 ~]# cobbler profile list
centos7.5-x86_64
centos7.5_ken

 

第十六步:删除在导入镜像的时候生成的profile文件

[root@ken1 ~]# cobbler profile remove –name=”centos7.5-x86_64″
[root@ken1 ~]# cobbler profile list
centos7.5_ken

 

第十七步:开机虚拟机验证

 

 

1,必须和服务器用一个网络模式

2. 内存至少大于2G 推荐3G

 

 

 

2 thoughts on “DAY8:课堂记录LAMP架构和cobbler–技术流ken

发表评论

电子邮件地址不会被公开。