顯示具有 centos 標籤的文章。 顯示所有文章
顯示具有 centos 標籤的文章。 顯示所有文章

2023年2月8日 星期三

CentOS6中無法使用Yum的處理

 

CentOS6官方已經不支援更新了。但是手上需要建一台…

作法是這樣

1.  備份CentOS-Base.repo

# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old

2. 建立 CentOS-Base.repo

# vi /etc/yum.repos.d/CentOS-Base.repo

貼入以下內容, 注意baseurl,如果失效可能會需要另外再找別的可以用的來替換

# CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/6.10/os/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://vault.centos.org/6.10/updates/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://vault.centos.org/6.10/extras/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://vault.centos.org/6.10/centosplus/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://vault.centos.org/6.10/contrib/$basearch/
        http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

3.  建立  epel.repo

# vi /etc/yum.repos.d/epel.repo

貼入以下

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

4.  執行
# yum makecache

這樣應該就完成了。可以正常使用yum功能了


資料來源:https://handle.idv.tw/centos6%E4%B8%AD%E7%84%A1%E6%B3%95%E4%BD%BF%E7%94%A8yum%E7%9A%84%E8%99%95%E7%90%86/

2016年4月18日 星期一

CentOS 7.2 Kernel升級

CentOS 7.2的原始kernel是3.10.0-327
目前最新版的kernel是4.5.0-1

人性始終來自帶墮性
人的努力,原自於不想出力

以前的kernel升級,必須要自已去下載binary,依自已的需求,調整內容
再complier過,才能放上去更新
一個不小心,可能就會讓系統崩潰

現在…似乎已經沒這麼麻煩了
(以下流程來自:http://www.ostechnix.com/install-linux-kernel-4-4-5-centos-ubuntu/)

Add ELRepo GPG key:
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
Then, add ELRepo in CentOS 7 / RHEL 7 / Scientific Linux 7 using command:
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Enable ELRepo fastest mirror using by installing the following package:
# yum install yum-plugin-fastestmirror
(fastestmirror似乎是CentOS7.2預設安裝,我執行這個命令時,告訴我已經有安裝了)

We have added the ELRepo. Now, it is time to install Linux kernel 4.4.1 LTS.
Let us find out the current version details with command:
# uname -r
Sample output:
3.10.0-123.9.3.el7.x86_64
As you see, the installed version is 3.10.0-123.9.3.el7.x86_64.
Install Linux Kernel 4.4.1 LTS using command:
# yum --enablerepo=elrepo-kernel install kernel-ml
到這裡已經安裝完成
再來只要確認GRUB預設是以kernel4.5.0-1開機,然後重新開機,就完成了





2015年6月22日 星期一

tar打包與解壓

環境:CentOS 6.6 x86_64

我的需求是打包後解包,所以不用壓縮,只用tar打包就好
語法~

tar -cvf filename.tar /etc /home /root /data

說明~
-c 打包為tar
-v 打包過程顯示
-f 指定打包的檔名
/etc /home /root /data 打包這4個目錄,包含子目錄及檔案,這樣系統重建時,只要直接倒回去就可以了。

解包
語法~

tar -xvf filename.tar -C /

說明
-x 解包
-C 指定解包後的目錄