可以通过以下两种方法来安装:
1、rpm 安装
rpm 下载源地址:http://mirrors.163.com/centos/6.2/os/x86_64/Packages/
下载wget的RPM包:http://mirrors.163.com/centos/6.2/os/x86_64/Packages/wget-1.12-1.4.el6.x86_64.rpm
rpm ivh wget-1.12-1.4.el6.x86_64.rpm 安装即可。
如果客户端用的是SecureCRT,linux下没装rzsz 包时,rz无法上传文件怎么办?我想到的是安装另一个SSH客户端:SSH Secure Shell。然后传到服务器上安装,这个比较费劲,所以推荐用第二种方法,不过如果yum包也没有安装的话,那就只能用这种方法了。
2、yum安装
yum -y install wget
显然第二种方法比较简单快捷。
Redhat 4说实话真心是太老了,可是没办法,给的环境就是这个,所以接受折磨吧,
这里把整个过程记录下来,留待后用。
1 安装yum
机器上没有一个软件包管理器着实蛋疼,所以首先是将这个搞定,下面是步骤
wget http://yum.baseurl.org/download/2.0/yum-2.0.8-1.src.rpm rpmbuild --rebuild yum-2.0.8-1.src.rpm cd /usr/src/redhat/RPMS/noarch/ rpm -ivh yum-2.0.8-1.noarch.rpm
然后是编辑相关的配置文件
vi /etc/yum.conf
[main] cachedir=/var/cache/yum debuglevel=2 logfile=/var/log/yum.log pkgpolicy=newest distroverpkg=redhat-release tolerant=1 exactarch=1 [base] name=Red Hat Linux $releasever - $basearch - Base baseurl=http://vault.centos.org/4.6/os/i386/ [updates] name=Red Hat Linux $releasever - Updates baseurl=http://vault.centos.org/4.6/updates/i386/
vi /etc/yum.repos.d/CentOS-Base.repo
#CentOS-Base.repo # # CentOS-4 is past End of Life ... use at your own risk # [base] name=CentOS-$releasever - Base baseurl=http://vault.centos.org/4.9/os/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4 #released updates [update] name=CentOS-$releasever - Updates baseurl=http://vault.centos.org/4.9/updates/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons baseurl=http://vault.centos.org/4.9/addons/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://vault.centos.org/4.9/extras/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://vault.centos.org/4.9/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib baseurl=http://vault.centos.org/4.9/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-centos4
由于默认的源都不能用了,所以都改成了vault.centos.org的源,当然如果版本稍微高点,可以
选用中科大的源:centos.ustc.edu.cn
最后一步,update
yum update
2 搭建git服务器
首先是安装git所需的一些依赖包
yum install curl yum install curl-devel yum install zlib-devel yum install openssl-devel yum install perl yum install expat-devel yum install gettext-devely
接着去下载git的源码
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
源码有了,就可以进行编译安装了
tar zvxf git-latest.tar.gz cd git-2013-03-29/(这个版本可能和我不一样,看下载的时间) autoconf ./configure make make install git -version如果有了下面的显示,那么恭喜你,git搭建好了
git version 1.8.2.GIT
这时还需要做一件事,就是配置环境变量
在.bashrc和.bash_profile中添加一句
export PATH=/home/svn/git-2013-03-29:$PATH(其中路径为下载的git源码路径,因为安装到了那个目录下)
3 配置git服务器
这个我就不罗嗦了,直接上步骤吧,跟着来就可以了
[root@localhost git]# mkdir test [root@localhost git]# git init --bare test Initialized empty Git repository in /home/git/test/ [root@localhost git]# cd test/ [root@localhost test]# mkdir initial [root@localhost test]# cd initial/ [root@localhost initial]# git init Initialized empty Git repository in /home/git/test/initial/.git/ [root@localhost initial]# git remote add origin /home/git/test [root@localhost initial]# touch Readme [root@localhost initial]# git add Readme [root@localhost initial]# git commit -m "initial commit" [master (root-commit) f067423] initial commit Committer: root <root@localhost.localdomain> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Readme [root@localhost initial]# git push origin master Counting objects: 3, done. Writing objects: 100% (3/3), 206 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To /home/git/test * [new branch] master -> master
4 客户端clone
you@you:~$ git clone ssh://usr@ip:port/home/git/test testgit Cloning into 'testgit'... usr@ip's password: remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done.
ok, 一切大功告成
有时候,我们需要单独安装nginx,来处理大量的下载请求。单独在Centos5安装nginx遇到的rewrite和HTTP cache错误解决办法:
wget http://nginx.org/download/nginx-0.8.33.tar.gz
tar -zxvf nginx-0.8.33.tar.gz
cd nginx-0.8.33
./configure --prefix=/usr/local/nginx
安装Nginx时报错
./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel解决问题
yum -y install pcre-devel
错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
解决办法:
yum -y install openssl openssl-devel
总结:
yum -y install pcre-devel openssl openssl-devel
./configure --prefix=/usr/local/nginx
make
make install
一切搞定