Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Linux系統安裝注意事項與裝好之後的初始化清單

一、安裝階段要留意的事

分區規劃

純學習用途可以這樣切:

  • /boot:200M
  • /swap:記憶體的1到2倍
  • /:依需要分配。虛擬機總空間15G的話,根分區給8~10G;生產環境60~100G都很常見
  • /opt:最好獨立分區用來放資料,重裝系統時這個分區保持不動,資料就不會遺失

軟件選擇

依需要挑選工具包。若只是學習,盡量最小化安裝,在最小化的基礎上補上中文語言支援即可。

二、系統初始化

1. 修改主機名稱

vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=larrywen.host.com

再用 hostname 指令立刻生效:

hostname
hostname larrywen.host.com
hostname

修改完重啟系統或關閉終端再執行hostname,就能看到新名稱。

2. 配置網路

vi /etc/sysconfig/network-scripts/

區域網路只要設定IPADDR與NETMASK即可。

3. 關閉安全相關服務

chkconfig NetworkManager off
chkconfig iptables off
chkconfig ip6tables off

/etc/init.d/iptables stop
/etc/init.d/ip6tables stop

setenforce 0    # 將SELINUX由enforcing改為permissive

若要永久生效,修改設定檔:

grep "^SELINUX=" /etc/sysconfig/selinux -n
8:SELINUX=permissive

4. 配置yum源

mkdir /iso
mount /dev/cdrom /iso
cd /iso
ll
cd /etc/yum.repos.d/
ls
cp rhel-source.repo iso.repo

編輯 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

測試安裝:

yum install vim man -y

mount在重啟後會失效,想永久生效就寫入 rc.local:

echo "mount /dev/cdrom /iso" >> /etc/rc.local
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. 其他

剩下的就依個人喜好調整,例如啟用中文輸入法、修改終端字型與配色等。

Copyright © Linux教程網 All Rights Reserved