linux-安裝後的准本工作,linux-安裝後工作

來源:互聯網
上載者:User

linux-安裝後的准本工作,linux-安裝後工作
1,關閉防火牆

查看防火牆狀態: 

[root@python_study ~]# service iptables statusiptables:未運行防火牆。

關閉與開啟防火牆:

需要重啟後才會生效,永久生效:

開啟: chkconfig iptables on

關閉: chkconfig iptables off

無需重啟,立即生效,但是重啟後失效:

開啟: service iptables start

關閉: service iptables stop

2,關閉selinux

查看selinux狀態

[root@python_study ~]# /usr/sbin/sestatus -vSELinux status:                 disabled

 

 某些系統,路徑可能是/usr/bin/sestatus

關閉selinux,修改為disabled。需要重啟啟動才會生效

[root@python_study ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:#     enforcing - SELinux security policy is enforced.#     permissive - SELinux prints warnings instead of enforcing.#     disabled - No SELinux policy is loaded.SELINUX=disabled# SELINUXTYPE= can take one of these two values:#     targeted - Targeted processes are protected,#     mls - Multi Level Security protection.SELINUXTYPE=targeted 

 

 3,設定主機名稱和IP地址

剛安裝好後的系統,用圖形化的自動連接發現串連不了,使用service network restart 報錯:Error getting 'State' for /org/freedesktop/NetworkManager/ActiveConnection/0: (19) Method "Get" wit

查了下好像RedHat自己開發的NetworkManager管理工具和/etc/sysconfig/network-scripts/ifcfg-ethx配置不同步造成的。

解決辦法1:

圖形介面,手動設定,系統--喜好設定--網路連接,手動設定IP地址等資訊

解決辦法2,找到ifcfg-eth0,添加資訊

[root@python_study ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0HWADDR=00:0C:29:DC:64:66TYPE=EthernetUUID=592393d3-001e-446a-bd6b-ad0a822901d2ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=noneIPADDR=192.168.1**,***  #自己設定的IPPREFIX=24GATEWAY=192.168.***,***  #網關

 

然後service network restrat就可以了

 

設定主機名稱:

查看主機名稱可以使用hostname命令查看,其取值來自

[root@python_study ~]# cat /etc/sysconfig/networkNETWORKING=yesHOSTNAME=python_study

 

 修改主機名稱讓他永久生效,就是修改這個檔案的HOSTNAME=主機名稱,需要重啟才會生效

如果臨時修改可以使用 hostname 主機名稱 ,重啟後時效

此時如果你使用hostname -i查看系統IP發現命令報錯,ping 本機名也報錯,是因為還為設定/etc/hosts檔案

開啟/etc/hosts檔案,在後面添加一行,IP地址  主機名稱  主機名稱.網域名稱

此時你也可以直接ping 主機名稱,其實就是ping的本機IP地址

此檔案是IP,主機名稱,網域名稱解析用的,可以在裡面添加其它的主機資訊。

 

上面這些做完了,可以做個快照,出了問題,可以好恢複的初始狀態

4,設定yum源

yum設定檔為/etc/yum.conf,下載源檔案位於 /etc/yum.repos.d/目錄中,.repo為副檔名

我的源檔案名稱為server.repo

server1為源檔案的id  

name定義yum源的完整名稱

baseurl定義yum源的URL地址,可以有http,ftp,file多種形式

enabled 是否啟用yum源,1是啟用

gpgcheck安裝包前是否檢查rpm包的軟體簽名,,不懂,所以不檢查

gpgkey 軟體包數位簽章的密鑰,啟用上面才用得到

我的是虛擬機器,掛載光碟片,mount /dev/cdrom /mnt ,有時在baseurl裡需要寫到Server這層路徑,但是我記得原來rhel5時好像只需要寫到/mnt就行

server.repo檔案內容如下:

[root@python_study ~]# mount /dev/cdrom /mntmount: block device /dev/sr0 is write-protected, mounting read-only[root@python_study ~]# ls /mntEFI      EULA_fr  EULA_zh           LoadBalancer              RELEASE-NOTES-bn-IN.html  RELEASE-NOTES-gu-IN.html  RELEASE-NOTES-ko-KR.html  RELEASE-NOTES-pt-BR.html  RELEASE-NOTES-zh-CN.html  RPM-GPG-KEY-redhat-releaseEULA     EULA_it  GPL               media.repo                RELEASE-NOTES-de-DE.html  RELEASE-NOTES-hi-IN.html  RELEASE-NOTES-ml-IN.html  RELEASE-NOTES-ru-RU.html  RELEASE-NOTES-zh-TW.html  ScalableFileSystemEULA_de  EULA_ja  HighAvailability  Packages                  RELEASE-NOTES-en-US.html  RELEASE-NOTES-it-IT.html  RELEASE-NOTES-mr-IN.html  RELEASE-NOTES-si-LK.html  repodata                  ServerEULA_en  EULA_ko  images            README                    RELEASE-NOTES-es-ES.html  RELEASE-NOTES-ja-JP.html  RELEASE-NOTES-or-IN.html  RELEASE-NOTES-ta-IN.html  ResilientStorage          TRANS.TBLEULA_es  EULA_pt  isolinux          RELEASE-NOTES-as-IN.html  RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-kn-IN.html  RELEASE-NOTES-pa-IN.html  RELEASE-NOTES-te-IN.html  RPM-GPG-KEY-redhat-beta[root@python_study ~]# cd /etc/yum.repos.d/[root@python_study yum.repos.d]# lsrhel-source.repo[root@python_study yum.repos.d]# mv rhel-source.repo rhel-source.repo.bak[root@python_study yum.repos.d]# vi server.repo[root@python_study yum.repos.d]# cat server.repo [server1]  name=rhel 6.4     baseurl=file:///mnt/Server/     enabled=1     gpgcheck=0

 

後面就可以使用 yum install 安裝包了

我這是設定的本地的yum源

參考自我當年剛工作時寫的部落格:http://9258124.blog.51cto.com/9248124/1676194

補充個:ftp:

基本安裝沒有帶ftp,yum install  vsftpd 安裝後 ,service vsftpd start

如果需要使用ftp工具用root使用者串連到這個linux系統,在/etc/vsftpd/下面有兩個帶user的檔案,編輯,把root注釋掉,重啟vsftpd服務就可以了。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.