首页 > 代码库 > 一、Linux系统安装
一、Linux系统安装
1.1 光盘安装
家用:内存 > 512M 硬盘 > 20G
桌面:内存 > 2G硬盘 > 60G
中型以上:内存 > 4G硬盘 > 120G
实验环境:
内存2G+硬盘128G+光盘CentOS6.6
欢迎界面-skip(跳过光盘检测)-简体中文-美国英语式-基本存储-Y忽略所有数据-
主机名-亚洲/上海(UTC)-密码-替换现有Linux-W格式化-Desktop[可自定义磁盘分区]-重新引导
同意-建用户--时间-Kdump[内核崩溃转储,需足够大内存]
安装后设置:
1、vim /etc/inittab更改启动级别为3
2、修改网络配置文件
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:37:df:c9
TYPE=Ethernet
UUID=55e3b1b2-0618-4ab0-bd0e-b25af465c7e2
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.124.200
NETMASK=255.255.255.0
DNS2=8.8.8.8
GATEWAY=192.168.124.1
DNS1=114.114.114.114
IPV6INIT=no
USERCTL=no
3、关闭防火墙及NetworkManager服务
# chkconfig --level 2345 iptables off
# chkconfig --level 2345 NetworkManager off
4、安装开发工具
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# yum makecache
# yum groupinstall "Development tools" "Server Platform Development" "Desktop Platform Development"
1.2 无人值守自动安装Liunx
PXE + DHCP + TFTP(传输启动文件) + Kickstart(NFS共享)
Kickstart:配置文件
yum install system-config-kuckstart
dhcp服务
# yum install dhcp
# cat /etc/dhcp/dhcpd.conf
subnet 172.16.0.0 netmask 255.255.0.0 {
range 172.16.0.100 172.16.0.200;
option domain-name-servers ns1.internal.example.org;
option routers 172.16.0.254;
default-lease-time 600;
max-lease-time 7200;
next-server 172.16.0.254;
filename "pxelinux.0";
}
tftp服务
# yum install tftp-server
# vim /etc/xinetd.d/tftp
disable= no
# yum install syslinux
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
# mount /dev/cdrom /media/
# cp /media/isolinux/{vmlinuz,initrd.img,vesamenu.c32,boot.msg} /var/lib/tftpboot/
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=nfs:172.16.0.254:/ks/ks.cfg
# chmod 644 /var/lib/tftpboot/pxelinux.cfg/default
# service xinetd restart
# chkconfig xinetd on
# mkdir /ks/
# cp anaconda-ks.cfg /ks/ks.cfg
# chmod +r /ks/ks.cfg
# cat /etc/exports
/ks172.16.0.0/255.255.0.0(ro)
/media172.16.0.0/255.255.0.0(ro)
使用nfs服务
# cat /etc/exports
/ks172.16.0.0/255.255.0.0(ro)
/media172.16.0.0/255.255.0.0(ro)
# service nfs start
# chkconfig nfs on
ks.cfg文件内容:
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=172.16.0.254 --dir=/media
# Root password
rootpw --iscrypted $1$109zdhJX$uxT1K/ZNrv6SySSgGZjEt.
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# System timezone
timezone Africa/Abidjan
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=2000
part / --fstype="ext4" --size=20000
%packages
@base
@chinese-support
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@java-platform
@legacy-x
@network-file-system-client
@office-suite
@print-client
@remote-desktop-clients
@server-platform
@server-policy
@workstation-policy
@x11
mtools
pax
oddjob
wodim
sgpio
genisoimage
device-mapper-persistent-data
abrt-gui
samba-winbind
certmonger
pam_krb5
krb5-workstation
libXmu
%end
1.3 无人值守自动安装Liunx
PXE + DHCP + TFTP(传输启动文件) + Kickstart(http共享)
使用http服务
vim /var/lib/tftpboot/pxelinux.cfg/default
append initrd=initrd.img ks=http://172.16.0.254/ks.cfg
cp /ks/ks.cfg /var/www/html/
cp -rf /media /var/www/html/
ks.cfg文件内容:
url --url="http://172.16.0.254/media"
1.4 cobbler自动安装Liunx
# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
# yum install cobbler tftp-server dhcp httpd xinetd
2
# setenforce 0
# cobbler check
# vim /etc/cobbler/settings
server: 192.168.1.254
next_server: 192.168.1.254
manage_dhcp: 1
3
# mount /dev/cdrom /media/
# cobbler import --path=/media/ --name=CentOS6.6 --arch=x86_64
查看挂载情况
# cobbler distro list
4
# vim /etc/cobbler/dhcp.template
# cp /var/www/html/ks.cfg /etc/cobbler/sample.ks
5
同步配置
# cobbler sync
6
启动服务
# service xinetd start
# service dhcpd start
# service cobblerd start
一、Linux系统安装