Step1. 系統掛載資料盤
df -h,看不到資料盤。
fdisk -l ,可以看到資料盤
執行“fdisk -S 56 /dev/xvdb”命令,對資料盤進行分區;
根據提示,依次輸入“n”,“p”“1”,兩次斷行符號,“wq”,分區就開始了,很快就會完成。
使用“fdisk -l”命令可以看到,新的分區xvdb1已經建立完成了。
使用“mkfs.ext3 /dev/xvdb1”命令對新分區進行格式化
使用“echo '/dev/xvdb1 /mnt ext3 defaults 0 0' >> /etc/fstab”(不含引號)命令寫入新分區資訊。
然後使用“cat /etc/fstab”命令查看。
使用“mount -a”命令掛載新分區,然後用“df -h”命令查看,出現以下資訊就說明掛載成功,可以開始使用新的分區了。
Step2 安裝node
確認伺服器有nodejs編譯及依賴相關軟體,如果沒有可通過運行以下命令安裝。
[root@BobServerStation local]# yum -y install gcc gcc-c++ openssl-devel
下載NodeJS源碼包並解壓。
[root@BobServerStation local]# wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
[root@BobServerStation local]# tar zxvf node-v0.10.24.tar.gz
[root@BobServerStation local]# cd node-v0.10.24
配置、編譯、安裝。
[root@BobServerStation node-v0.10.24]# ./configure --prefix=/usr/local/node
[root@BobServerStation node-v0.10.24]# make && make install
接下來配置Node環境
[root@BobServerStation node-v0.10.24]# vim /etc/profile
#set nodejs env
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
export NODE_PATH=$NODE_HOME/lib/node_modules:$PATH
[root@BobServerStation node-v0.10.24]# source /etc/profile --重啟生效
測試是否安裝成功
[root@BobServerStation node-v0.10.24]# node -v
v0.10.24
step3 搭建git伺服器
安裝git:
#yum install git
安裝python的setuptool
#yum install python python-setuptools
安裝gitosis
#git clone git://github.com/res0nat0r/gitosis.git
#cd gitosis/
#python setup.py install
用戶端生產密鑰並上傳到伺服器端:
#ssh-keygen -t rsa
#scp ~/.ssh/id_rsa.pub root@伺服器ip:~/
在伺服器端產生管理庫:
#sudo -H -u git gitosis-init < ~/id_rsa.pub
Initialized empty Git repository in /home/git//repositories/gitosis-admin.git/ Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
註解:
1. 產生的gitosis-admin為Git的使用者存取權限管理庫,gitosis通過這個git庫來管理所有git庫的存取權限。
2. 通過執行初始化,該公開金鑰的擁有者就能修改用於配置gitosis的那個特殊Git倉庫了
修改上傳許可權:
#chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update