您的位置:首页 > 运维架构 > Linux

Linux安装系统注意事项及系统初始化

2017-03-05 13:30 253 查看
     Linux安装系统注意事项

 

        1.分区

        学习用途:

        /boot:200M

        /swap :内存的1到2倍

        /:根据需要分配大小,比如虚拟机下总空间是15G,那么可以分配8——10G跟/分区,如果是生产环境,60——100G都很正常

        /opt:最好有个单独的分区,用以存储数据、资料,下次使用系统此分区保持不变,就不会丢失数据。

        2.根据需要安装工具包。

        3. 学习使用的话尽可能最小化安装,只需要在最小化的基础上安装中文支持包即可。

 

 

        系统初始化

        1.修改主机名字

 

[plain] view
plain copy

[root@localhost Desktop]# vim /etc/sysconfig/network  

  

[root@localhost Desktop]# cat /etc/sysconfig/network  

NETWORKING=yes  

HOSTNAME=larrywen.host.com  

  

[root@localhost Desktop]# hostname  

localhost.localdomain  

  

[root@localhost Desktop]# hostname larrywen.host.com  

[root@localhost Desktop]# hostname  

larrywen.host.com  

#修改完后重启系统或者关闭终端,再次执行hostname修改就可以看到效果  

        2.配置网络

[plain] view
plain copy

[root@larrywen ~]# vi /etc/sysconfig/network-scripts/  

#局域网,配置IPADDR和NETMASK即可  

        3.关闭安全相关的比如SELINUX防火墙

[plain] view
plain copy

[root@larrywen ~]# chkconfig NetworkManager off  

[root@larrywen ~]# chkconfig iptables off  

[root@larrywen ~]# chkconfig ip6tables off  

  

[root@larrywen ~]# /etc/init.d/iptables stop  

[root@larrywen ~]# /etc/init.d/ip6tables stop  

  

  

[root@larrywen ~]# setenforce 0  

#将SELINUX有enabled改为permissive  

[root@localhost ~]# grep "^SELINUX=" /etc/sysconfig/selinux -n  

8:SELINUX=permissive  

        4.yum源的配置

[plain] view
plain copy

[root@localhost ~]# mkdir /iso  

mount /dev/cdrom /iso  

cd /iso  

ll  

[root@localhost iso]# cd /etc/yum.repos.d/  

[root@localhost yum.repos.d]# ls  

rhel-source.repo  

[root@localhost yum.repos.d]# cp rhel-source.repo iso.repo  

  

[root@localhost yum.repos.d]# cat iso.repo   

[rhel-iso]  

name=Red Hat Enterprise Linux $releasever - $basearch - Source  

baseurl=file:///iso  

enabled=1  

gpgcheck=0  

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release  

  

[root@localhost yum.repos.d]# yum install vim man -y  

  

#mount后重启失效,要想永久生效,添加此句话  

[root@localhost yum.repos.d]# echo "mount /dev/cdrom /iso" >> /etc/rc.local   

[root@localhost yum.repos.d]# cat /etc/rc.local   

#!/bin/sh  

#  

# This script will be executed *after* all the other init scripts.  

# You can put your own initialization stuff in here if you don't  

# want to do the full Sys V style init stuff.  

  

touch /var/lock/subsys/local  

mount /dev/cdrom /iso  

        5.其他可以自行配置,比如启用中文输入法、修改终端字体和颜色等等
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: