自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

CentOS系統(tǒng)安裝后的初始環(huán)境設(shè)置

系統(tǒng) Linux
在CentOS系統(tǒng)安裝好之后,對(duì)安全性以及對(duì)硬件的適應(yīng)性方面不合適的情況下,對(duì)新的CentOS系統(tǒng)進(jìn)行初始環(huán)境設(shè)置。

在CentOS系統(tǒng)安裝好之后,安全性以及對(duì)硬件的適應(yīng)性方面,可能并不完全符合我們的實(shí)際情況。在這里,對(duì)新的CentOS系統(tǒng)進(jìn)行初始環(huán)境設(shè)置將以如下方面為原則:
1,為了安全,盡***可能將訪問限制限制到可能的***程度;
2,為了節(jié)省內(nèi)存及 CPU 使用率(以及安全方面的考慮),盡***可能將不需要的服務(wù)關(guān)閉;
3,為了減少誤操作可能帶來的損失,平時(shí)通過 wheel 組用戶登錄進(jìn)行系統(tǒng)管理;
4,為了讓系統(tǒng)變的更加輕便、快速,將內(nèi)核中不需要的模塊卸載;

CentOS系統(tǒng) 4.4 的安裝后初始環(huán)境設(shè)定
 
安裝完畢重新啟動(dòng)系統(tǒng)后,出現(xiàn)如下的狀態(tài):
CentOS release 4.4 (Final)
Kernel 2.6.9-42.EL on an i686
sample login:   ← 根據(jù)安裝時(shí)網(wǎng)絡(luò)設(shè)置的情況的不同,本站以“sample”,其位置顯示的是你設(shè)置好的主機(jī)名。

[1] 系統(tǒng)的登錄與退出

sample login: root ← 用root用戶來登錄系統(tǒng),輸入用戶名root
Password: ← 在這里輸入安裝時(shí)設(shè)置的root密碼,輸入時(shí)密碼不會(huì)被顯示
[root@sample ~]# ← root用戶登錄成功,提示符為“#”。若一般用戶登錄成功后,提示符為“$”
[root@sample ~]# exit ← 退出系統(tǒng)
sample login: ← 退出系統(tǒng)成功

[2] 一般用戶的建立與刪除

[root@sample ~]# useradd centospub ← 建立用戶名為 centospub 的一般用戶
[root@sample ~]# passwd centospub ← 為用戶 centospub 設(shè)置密碼
Changing password for user centospub.
New UNIX password:  ← 輸入密碼(密碼不會(huì)被顯示)
Retype new UNIX password:  ← 再次輸入密碼確認(rèn)兩次密碼一致
passwd: all authentication tokens updated successfully. ← 密碼設(shè)置成功
[root@sample ~]# userdel -r centospub ← 刪除用戶名為 centospub 的一般用戶

[3] 通過一般用戶登錄為root用戶

因?yàn)閞oot用戶對(duì)系統(tǒng)具有全權(quán)的操作權(quán)限,為了避免一些失誤的操作,建議在一般情況下,以一般用戶登錄系統(tǒng),必要的時(shí)候需要root操作權(quán)限時(shí),再通過“su -”命令來登錄為root用戶進(jìn)行操作。
[centospub@sample ~]$  ← 提示符為“$”,說明當(dāng)前狀態(tài)為一般用戶CentOS系統(tǒng)pub登錄在系統(tǒng)中
[centospub@sample ~]$ su -  ← 輸入登錄為root用戶的命令
Password:   ← 輸入root密碼(密碼不會(huì)被顯示),回車
[root@sample ~]# ← 成功登錄為root用戶,提示符變?yōu)椤?”
[root@sample ~]# exit ← 回到一般用戶的登錄狀態(tài)
[centospub@sample ~]$ ← 提示符變?yōu)椤?”,回到了一般用戶CentOS系統(tǒng)pub登錄系統(tǒng)的狀態(tài)

[4] 建立管理員組內(nèi)一般用戶

在 一般情況下,一般用戶通過執(zhí)行“su -”命令、輸入正確的root密碼,可以登錄為root用戶來對(duì)系統(tǒng)進(jìn)行管理員級(jí)別的配置。但是,為了更進(jìn)一步加強(qiáng)系統(tǒng)的安全性,有必要建立一個(gè)管理員的 組,只允許這個(gè)組的用戶來執(zhí)行“su -”命令登錄為root用戶,而讓其他組的用戶即使執(zhí)行“su -”、輸入了正確的root密碼,也無法登錄為root用戶。在UNIX下,這個(gè)組的名稱通常為“wheel”。

[root@sample ~]# usermod -G wheel centospub  ← 將一般用戶 centospub 加在管理員組wheel組中
[root@sample ~]# vi /etc/pam.d/su  ← 打開這個(gè)配置文件
#auth required /lib/security/$ISA/pam_wheel.so use_uid   ← 找到此行,去掉行首的“#”
auth required /lib/security/$ISA/pam_wheel.so use_uid  ← 變?yōu)榇藸顟B(tài)(大約在第6行的位置)
[root@sample ~]# echo "SU_WHEEL_ONLY yes" >> /etc/login.defs ← 添加語句到行末

以上操作完成后,可以再建立一個(gè)新用戶,然后用這個(gè)新建的用戶測(cè)試會(huì)發(fā)現(xiàn),沒有加入到wheel組的用戶,執(zhí)行“su -”命令,即使輸入了正確的root密碼,也無法登錄為root用戶。

[5] 建立PPPoE連接(非xDSL接入方式的用戶可跳過此步驟)

  1. [root@sample ~]# adsl-setup  ← 建立ADSL連接  
  2. Welcome to the ADSL client setup. First, I will run some checks on  
  3. your system to make sure the PPPoE client is installed properly...  
  4. LOGIN NAME  
  5. Enter your Login Name (default root): ← 填入ADSL連接的用戶名  
  6. INTERFACE  
  7. Enter the Ethernet interface connected to the ADSL modem  
  8. For Solaris, this is likely to be something like /dev/hme0.  
  9. For Linux, it will be ethX, where 'X' is a number.  
  10. (default eth0):  ← 指定網(wǎng)絡(luò)接入設(shè)備,一塊網(wǎng)卡的情況下,一般為默認(rèn)eth0  
  11. Do you want the link to come up on demand, or stay up continuously?  
  12. If you want it to come up on demand, enter the idle time in seconds  
  13. after which the link should be dropped. If you want the link to  
  14. stay up permanently, enter 'no' (two letters, lower-case.)  
  15. NOTE: Demand-activated links do not interact well with dynamic IP  
  16. addresses. You may have some problems with demand-activated links.  
  17. Enter the demand value (default no):  ← 直接按回車,接受默認(rèn)設(shè)置  
  18. DNS  
  19. Please enter the IP address of your ISP's primary DNS server.  
  20. If your ISP claims that 'the server will provide dynamic DNS addresses',  
  21. enter 'server' (all lower-case) here.  
  22. If you just press enter, I will assume you know what you are  
  23. doing and not modify your DNS setup.  
  24. Enter the DNS information here:  ← 如果知道DNS服務(wù)器的信息在此填入。不知道的情況按回車跳過  
  25. PASSWORD  
  26. Please enter your Password: ← 輸入ADSL的連接密碼  
  27. Please re-enter your Password: ← 再次確認(rèn)輸入ADSL的連接密碼  
  28. USERCTRL  
  29. Please enter 'yes' (two letters, lower-case.) if you want to allow  
  30. normal user to start or stop DSL connection (default yes): no ← 填入no,不允許一般用戶控制PPPoE的連接  
  31. FIREWALLING  
  32. Please choose the firewall rules to use. Note that these rules are  
  33. very basic. You are strongly encouraged to use a more sophisticated  
  34. firewall setup; however, these will provide basic security. If you  
  35. are running any servers on your machine, you must choose 'NONE' and  
  36. set up firewalling yourself. Otherwise, the firewall rules will deny  
  37. access to all standard servers like Web, e-mail, ftp, etc. If you  
  38. are using SSH, the rules will block outgoing SSH connections which  
  39. allocate a privileged source port.  
  40.  
  41. The firewall choices are:  
  42. 0 - NONE: This script will not set any firewall rules. You are responsible  
  43. for ensuring the security of your machine. You are STRONGLY  
  44. recommended to use some kind of firewall rules.  
  45. 1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation  
  46. 2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway  
  47. for a LAN  
  48. Choose a type of firewall (0-2): 0 ← 輸入0,不在這里使用防火墻  
  49.  
  50. Start this connection at boot time  
  51. Do you want to start this connection at boot time?  
  52. Please enter no or yes (default no): yes ← 填入yes,在系統(tǒng)啟動(dòng)時(shí)自動(dòng)連接ADSL  
  53. ** Summary of what you entered **  
  54. Ethernet Interface: eth0  
  55. User name: caun870293@ca.dti.ne.jp  
  56. Activate-on-demand: No  
  57. DNS: Do not adjust  
  58. Firewalling: NONE  
  59. User Control: no  
  60. Accept these settings and adjust configuration files (y/n)? y ← 配置信息確認(rèn)無誤后,鍵入y同意設(shè)置  
  61. Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0  
  62. Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets  
  63. (But first backing it up to /etc/ppp/chap-secrets.bak)  
  64. (But first backing it up to /etc/ppp/pap-secrets.bak)  
  65. ?  
  66. Congratulations, it should be all set up!  
  67. Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'  
  68. to bring it down.  
  69. Type '/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0'  
  70. to see the link status.  
  71.  

然后,啟動(dòng)ADSL連接。
[root@sample ~]# adsl-start  ← 啟動(dòng)ADSL連接
[root@sample ~]#   ← 稍等片刻后若啟動(dòng)成功后出現(xiàn)提示符(無任何提示即意味著連接成功)
這時(shí),通過“ifconfig”命令可以看到各網(wǎng)絡(luò)接口的信息(IP地址等等)。

[6] root郵件的轉(zhuǎn)送

在系統(tǒng)出現(xiàn)錯(cuò)誤或有重要通知發(fā)送郵件給root的時(shí)候,讓系統(tǒng)自動(dòng)轉(zhuǎn)送到我們通常使用的郵箱中,這樣方便查閱相關(guān)報(bào)告和日志。
[root@sample ~]# vi /etc/aliases   ← 編輯aliases,添加如下行到文尾
root: yourname@yourserver.com ← 加入自己的郵箱地址
[root@sample ~]# newaliases ← 重建aliasesdb
/etc/aliases: 79 aliases, longest 19 bytes, 825 bytes total
[root@sample ~]# echo test | mail root ← 發(fā)送測(cè)試郵件給root

如果成功的話,會(huì)在剛剛填入的 yourname@yourserver.com 的郵箱中收到測(cè)試的郵件。

[7] locate命令用數(shù)據(jù)庫更新及自動(dòng)更新設(shè)定

locate命令是Linux下告訴搜索文件用的工具,它的原理和Windows下的“Google桌面搜索”有點(diǎn)類似,是通過事先建立數(shù)據(jù)庫的方式,來達(dá)到高速查找目標(biāo)文件的目的。

[root@sample ~]# vi /etc/updatedb.conf  ← 編輯locate數(shù)據(jù)庫更新配置文件
DAILY_UPDATE=no  ← 找到這一行,將“no”改為“yes”
DAILY_UPDATE=yes  ← 變?yōu)榇藸顟B(tài)后,保存、退出
[root@sample ~]# updatedb  ← 運(yùn)行l(wèi)ocate數(shù)據(jù)庫更新命令,稍等片刻…更新成功后出現(xiàn)提示符

[8] 定義yum的非官方庫

在服務(wù)器構(gòu)建的過程中,我們將要用到的一些工具不存在于CentOS系統(tǒng)中yum的官方庫中,所以需要定義yum的非官方庫文件,讓一些必需的工具通過yum也能夠安裝。

  1. [root@sample ~]# vi /etc/yum.repos.d/dag.repo  ← 建立dag.repo,定義非官方庫  
  2. [dag]  
  3. name=Dag RPM Repository for Red Hat Enterprise Linux  
  4. baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag  
  5. gpgcheck=1 
  6. enabled=1 
  7. [root@sample ~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt  ← 導(dǎo)入非官方庫的GPG  

[9] 停止打印服務(wù)

如果不準(zhǔn)備提供打印服務(wù),停止默認(rèn)被設(shè)置為自動(dòng)啟動(dòng)的打印服務(wù)。

 

  1. [root@sample ~]# /etc/rc.d/init.d/cups stop  ← 停止打印服務(wù)  
  2. Stopping cups:            [ OK ]    ← 停止服務(wù)成功,出現(xiàn)“OK”  
  3. [root@sample ~]# chkconfig cups off  ← 禁止打印服務(wù)自動(dòng)啟動(dòng)  
  4. [root@sample ~]# chkconfig --list cups  ← 確認(rèn)打印服務(wù)自啟動(dòng)設(shè)置狀態(tài)  
  5. cups 0:off 1:off 2:off 3:off 4:off 5:off 6:off  ← 0-6都為off的狀態(tài)就OK(當(dāng)前打印服務(wù)自啟動(dòng)被禁止中)   
  6.  

[10] 停止ipv6

在CentOS系統(tǒng)默認(rèn)的狀態(tài)下,ipv6是被啟用的狀態(tài)。因?yàn)槲覀儾皇褂胕pv6,所以,停止ipv6,以***限度保證安全和快速。
首先再次確認(rèn)一下ipv6功能是不是被啟動(dòng)的狀態(tài)。

[root@sample ~]# ifconfig -a ← 列出全部網(wǎng)絡(luò)接口信息

  1. eth0 Link encap:Ethernet HWaddr 00:0C:29:B6:16:A3  
  2. inet addr:192.168.0.13 Bcast:192.168.0.255 Mask:255.255.255.0  
  3. inet6 addr: fe80::20c:29ff:feb6:16a3/64 Scope:Link  
  4. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1  
  5. RX packets:84 errors:0 dropped:0 overruns:0 frame:0  
  6. TX packets:93 errors:0 dropped:0 overruns:0 carrier:0  
  7. collisions:0 txqueuelen:1000  
  8. RX bytes:10288 (10.0 KiB) TX bytes:9337 (9.1 KiB)  
  9. Interrupt:185 Base address:0x1400   
  10. lo Link encap:Local Loopback  
  11. inet addr:127.0.0.1 Mask:255.0.0.0  
  12. inet6 addr: ::1/128 Scope:Host  
  13. UP LOOPBACK RUNNING MTU:16436 Metric:1  
  14. RX packets:12 errors:0 dropped:0 overruns:0 frame:0  
  15. TX packets:12 errors:0 dropped:0 overruns:0 carrier:0  
  16. collisions:0 txqueuelen:0  
  17. RX bytes:952 (952.0 b) TX bytes:952 (952.0 b)  
  18. sit0 Link encap:IPv6-in-IPv4 ← 確認(rèn)ipv6是被啟動(dòng)的狀態(tài)  
  19. NOARP MTU:1480 Metric:1  
  20. RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
  21. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0  
  22. collisions:0 txqueuelen:0  
  23. RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)   
  24.  

CentOS系統(tǒng)安裝后然后修改相應(yīng)配置文件,停止ipv6。

[root@sample ~]# vi /etc/modprobe.conf ← 修改相應(yīng)配置文件,添加如下行到文尾:
alias net-pf-10 off
alias ipv6 off
[root@sample ~]# shutdown -r now  ← 重新啟動(dòng)系統(tǒng),使設(shè)置生效

***確認(rèn)ipv6的功能已經(jīng)被關(guān)閉。

  1. [root@sample ~]# ifconfig -a ← 列出全部網(wǎng)絡(luò)接口信息  
  2. eth0 Link encap:Ethernet HWaddr 00:0C:29:B6:16:A3  
  3. inet addr:192.168.0.13 Bcast:192.168.0.255 Mask:255.255.255.0  
  4. inet6 addr: fe80::20c:29ff:feb6:16a3/64 Scope:Link  
  5. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1  
  6. RX packets:84 errors:0 dropped:0 overruns:0 frame:0  
  7. TX packets:93 errors:0 dropped:0 overruns:0 carrier:0  
  8. collisions:0 txqueuelen:1000  
  9. RX bytes:10288 (10.0 KiB) TX bytes:9337 (9.1 KiB)  
  10. Interrupt:185 Base address:0x1400 lo Link encap:Local Loopback  
  11. inet addr:127.0.0.1 Mask:255.0.0.0  
  12. inet6 addr: ::1/128 Scope:Host  
  13. UP LOOPBACK RUNNING MTU:16436 Metric:1  
  14. RX packets:12 errors:0 dropped:0 overruns:0 frame:0  
  15. TX packets:12 errors:0 dropped:0 overruns:0 carrier:0  
  16. collisions:0 txqueuelen:0  
  17. RX bytes:952 (952.0 b) TX bytes:952 (952.0 b)  

(確認(rèn)ipv6的相關(guān)信息沒有被列出,說明ipv6功能已被關(guān)閉。)

【編輯推薦】

  1. CentOS系統(tǒng)是Linux常見版本之一
  2. CentOS系統(tǒng)CPU過熱處理的解決方法
  3. CentOS系統(tǒng)操作下安裝相關(guān)各種軟件
  4. MySQL CentOS系統(tǒng)管理文件安裝
  5. Linux centos系統(tǒng)的IP設(shè)置配置
責(zé)任編輯:小霞
相關(guān)推薦

2010-03-25 14:42:33

2011-03-09 16:16:56

CentOSLAMP

2010-02-23 14:45:52

CentOS LEMP

2010-02-22 18:18:14

CentOS vsft

2010-02-22 16:18:29

CentOS cact

2010-03-26 12:50:02

CentOS系統(tǒng)

2011-08-19 16:59:54

windows7初始設(shè)置項(xiàng)

2010-03-11 19:25:35

Python環(huán)境

2010-01-15 13:55:17

CentOS mail

2010-01-13 17:24:07

Centos 5.1系

2010-01-13 10:14:45

2011-03-25 16:23:43

CentOSNagios

2011-02-23 14:38:39

安裝CentOS vsftpd

2011-02-23 14:38:39

安裝CentOS vsftpd

2011-08-19 17:00:47

windows7初始設(shè)置項(xiàng)

2010-03-30 15:24:28

CentOS系統(tǒng)

2011-03-31 16:46:10

LinuxMySQL

2010-03-01 16:51:53

CentOS VMwa

2010-03-31 17:36:10

CentOS系統(tǒng)

2011-03-09 16:28:25

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)