CentOS5.1にGitをインストールする
CentOSが5.1でもGitは使いたい。
※1年くらい前の作業メモなので今でもこの通りいくか不明。
※自己責任で試しましょう。
参考にさせていただいた記事はこちら。
CentOS5.8にyumでgitをインストールする | hypermkt blog
とりあえず普通にyumでインストールしてみる。
[vagrant@localhost ~]$ sudo yum -y install git Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.tsukuba.wide.ad.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp Setting up Install Process No package git available. Nothing to do
No package git available.だって。
どうやらCentOSのデフォルトのyumリポジトリではgitがないらしい。
epelリポジトリの入手
[vagrant@localhost ~]$ sudo rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm Retrieving http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm warning: /var/tmp/rpm-xfer.oDCufz: Header V3 DSA signature: NOKEY, key ID 217521f6 Preparing... ########################################### [100%] 1:epel-release ########################################### [100%]
このままだとepelリポジトリがCentOSの公式リポジトリより優先されてしまうようなので、
公式リポジトリを優先するように設定しておかないといけない。
てことでどのリポジトリを優先的に利用するか設定するためにyum-prioritiesをインストールする。
yum-prioritiesのインストール
[vagrant@localhost ~]$ sudo yum install yum-priorities Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.tsukuba.wide.ad.jp * epel: ftp.kddilabs.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp epel | 3.6 kB 00:00 epel/primary_db | 2.9 MB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-priorities.noarch 0:1.1.16-21.el5.centos set to be updated --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: yum-priorities noarch 1.1.16-21.el5.centos base 16 k Transaction Summary ======================================================================================================================================================================= Install 1 Package(s) Upgrade 0 Package(s) Total download size: 16 k Is this ok [y/N]: y Downloading Packages: yum-priorities-1.1.16-21.el5.centos.noarch.rpm | 16 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : yum-priorities 1/1 Installed: yum-priorities.noarch 0:1.1.16-21.el5.centos Complete!
yum-prioritiesがインストールできたら、
baseのprioirtyを1で、他を2とかにすればいける。(たぶん)
Baseリポジトリの優先度を上げる
[vagrant@localhost ~]$ sudo vi /etc/yum.repos.d/CentOS-Base.repo [base] ... +priority=1 #released updates [updates] ... +priority=2 #additional packages that may be useful [extras] ... +priority=2 #additional packages that extend functionality of existing packages [centosplus] ... +priority=2 #contrib - packages by Centos Users [contrib] ... +priority=2
Gitをインストールする
[vagrant@localhost ~]$ sudo yum install git Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * base: ftp.tsukuba.wide.ad.jp * epel: ftp.kddilabs.jp * extras: ftp.tsukuba.wide.ad.jp * updates: ftp.tsukuba.wide.ad.jp base | 1.1 kB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package git.x86_64 0:1.8.2.3-1.el5 set to be updated --> Processing Dependency: perl-Git = 1.8.2.3-1.el5 for package: git --> Processing Dependency: rsync for package: git --> Processing Dependency: perl(Term::ReadKey) for package: git --> Processing Dependency: perl(Git) for package: git --> Processing Dependency: perl(Error) for package: git --> Running transaction check ---> Package perl-Error.noarch 1:0.17010-1.el5 set to be updated ---> Package perl-Git.x86_64 0:1.8.2.3-1.el5 set to be updated ---> Package perl-TermReadKey.x86_64 0:2.30-4.el5 set to be updated ---> Package rsync.x86_64 0:3.0.6-6.el5_11 set to be updated --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: git x86_64 1.8.2.3-1.el5 epel 17 M Installing for dependencies: perl-Error noarch 1:0.17010-1.el5 epel 26 k perl-Git x86_64 1.8.2.3-1.el5 epel 45 k perl-TermReadKey x86_64 2.30-4.el5 epel 32 k rsync x86_64 3.0.6-6.el5_11 updates 347 k Transaction Summary ======================================================================================================================================================================= Install 5 Package(s) Upgrade 0 Package(s) Total download size: 17 M Is this ok [y/N]: y Downloading Packages: (1/5): perl-Error-0.17010-1.el5.noarch.rpm | 26 kB 00:00 (2/5): perl-TermReadKey-2.30-4.el5.x86_64.rpm | 32 kB 00:00 (3/5): perl-Git-1.8.2.3-1.el5.x86_64.rpm | 45 kB 00:00 (4/5): rsync-3.0.6-6.el5_11.x86_64.rpm | 347 kB 00:00 (5/5): git-1.8.2.3-1.el5.x86_64.rpm | 17 MB 00:03 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 3.1 MB/s | 17 MB 00:05 warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6 epel/gpgkey | 1.7 kB 00:00 Importing GPG key 0x217521F6 "Fedora EPEL" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-Error 1/5 Installing : perl-TermReadKey 2/5 Installing : rsync 3/5 Installing : git 4/5 Installing : perl-Git 5/5 Installed: git.x86_64 0:1.8.2.3-1.el5 Dependency Installed: perl-Error.noarch 1:0.17010-1.el5 perl-Git.x86_64 0:1.8.2.3-1.el5 perl-TermReadKey.x86_64 0:2.30-4.el5 rsync.x86_64 0:3.0.6-6.el5_11 Complete!
[vagrant@localhost ~]$ git --version git version 1.8.2.3
無事インストールできました。
VagrantでCentOS5.1の開発環境を作る
CentOSの5系で開発してくれって言うお客さんがいたので、
四苦八苦しながら環境構築したときのメモの書き起こし。
1年くらい前の作業メモなので今でもこの通りいくか不明。
※自己責任で試しましょう。
環境
・Windows 7
・VirtualBox 5.0.14
・Vagrant 1.8.1
CentOS5.1のboxを持ってくる。
$ mkdir vagrant $ cd vagrant $ mkdir centos5 $ cd centos5 $ vagrant box add centos5.1 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box ==> box: Box file was not detected as metadata. Adding it directly... ==> box: Adding box 'centos5.1' (v0) for provider: box: Downloading: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box box: ==> box: Successfully added box 'centos5.1' (v0) for 'virtualbox'! //boxが追加されたか確認 $ vagrant box list centos5.1 (virtualbox, 0) //立ち上げる $ vagrant init centos5.1 $ vagrant up (長いので略) Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was: mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant The error output from the last command was: /sbin/mount.vboxsf: mounting failed with the error: No such device
なんかマウントが失敗したっぽいエラー。
下記の記事がそのまま参考になりました。
qiita.com
よくわからんがカーネルのソースへのパス設定しなおさないとダメっぽい。
カーネルの設定。
//vagrant sshでログイン $ vagrant ssh //kernel-develインストールする [vagrant@localhost ~]$ sudo yum install kernel-devel -y [vagrant@localhost ~]$ ls /usr/src/kernels/ 2.6.18-412.el5-x86_64 [vagrant@localhost ~]$ uname -r 2.6.18-371.el5 [vagrant@localhost ~]$ su - [root@localhost ~]# echo "KERN_DIR=/usr/src/kernels/2.6.18-406.el5-x86_64" >> .bash_profile [root@localhost ~]# yum info kernel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.nara.wide.ad.jp * extras: ftp.nara.wide.ad.jp * updates: ftp.nara.wide.ad.jp Installed Packages Name : kernel Arch : x86_64 Version : 2.6.18 Release : 371.el5 Size : 99 M Repo : installed Summary : The Linux kernel (the core of the Linux operating system) URL : http://www.kernel.org/ License : GPLv2 Description: The kernel package contains the Linux kernel (vmlinuz), the core of any : Linux operating system. The kernel handles the basic functions : of the operating system: memory allocation, process allocation, device : input and output, etc. Available Packages Name : kernel Arch : x86_64 Version : 2.6.18 Release : 412.el5 Size : 22 M Repo : updates Summary : The Linux kernel (the core of the Linux operating system) URL : http://www.kernel.org/ License : GPLv2 Description: The kernel package contains the Linux kernel (vmlinuz), the core of any : Linux operating system. The kernel handles the basic functions : of the operating system: memory allocation, process allocation, device : input and output, etc. [root@localhost ~]# yum update kernel -y [root@localhost ~]# shutdown -r now
VagrantでCentOSを使ってローカル開発環境を整える
Vagrantをダウンロードする
下記からダウンロード
https://www.vagrantup.com/downloads.html
バージョンは1.8.1だった。
VirtualBoxをダウンロードする
http://download.virtualbox.org/virtualbox/5.0.14/VirtualBox-5.0.14-105127-Win.exe