命令操作如下所示: [root@localhost /]# yum -y groupinfo “开发工具”
1)部署编译安装环境 可以通过安装“开发工具”包组,也可以通过命令“yum –y install gcc*”来实现。命令操作如下所示:
[root@localhost /]# yum -y install gcc* [root@localhost /]# gcc --version //查看gcc编译器版本 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) Copyright ? 2010 Free Software Foundation, Inc. 本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保; 包括没有适销性和某一专用目的下的适用性担保。 [root@localhost /]# make --version //查看make工具版本 GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for x86_64-redhat-linux-gnu [root@localhost /]#2)获得httpd源代码包,利用tar命令解包 本例中利用VMware Tools工具,将httpd源码包上传到Linux服务器上,然后利用tar命令解包,相关命令操作如下所示:
[root@localhost 桌面]# pwd /root/桌面 [root@localhost 桌面]# ls httpd-2.2.25.tar.gz [root@localhost 桌面]# tar -zxf httpd-2.2.25.tar.gz -C /usr/src/ [root@localhost 桌面]# ls /usr/src debug httpd-2.2.25 kernels vmware-tools-distrib [root@localhost 桌面]#3)切换到解压目录,配置编译参数
[root@localhost 桌面]# cd /usr/src/httpd-2.2.25/ [root@localhost httpd-2.2.25]# ./configure --prefix=/usr/local/apache //配置 ……4)依次执行编译、安装过程
[root@localhost httpd-2.2.25]# make //编译 …… [root@localhost httpd-2.2.25]# make install //安装 ……5)确认安装结果,并启用httpd服务 查看安装完成后的程序目录:
[root@localhost httpd-2.2.25]# ls /usr/local/apache/ bin build cgi-bin conf error htdocs icons include lib logs man manual modules [root@localhost httpd-2.2.25]#开启httpd服务(运行脚本):
[root@localhost httpd-2.2.25]# /usr/local/apache/bin/apachectl start httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName [root@localhost httpd-2.2.25]#通过本机的Firefox浏览器访问 http://localhost/,应该能看到“IT Works! ”的默认网页,如图-1所示,说明httpd安装并运行成功。
1)解包、进入源码目录:
[root@localhost 桌面]# cd /root/桌面 [root@localhost 桌面]# tar zxf aria2-1.17.1.tar.gz [root@localhost 桌面]# cd aria2-1.17.12)配置,./configure :
[root@localhost aria2-1.17.1]# ./configure .. .. Message Digest: yes WebSocket: yes Libaria2: no bash_completion dir: ${datarootdir}/doc/${PACKAGE_TARNAME}/bash_completion Static build:3)编译、安装,make && make install 其中&&符号为连接符号,意思是前边命令执行成功后则执行后面命令:
[root@localhost aria2-1.17.1]# make && make install .. .. make[2]: Entering directory `/root/Desktop/tools/aria2-1.17.1' make[2]: Nothing to be done for `install-exec-am'. /bin/mkdir -p '/usr/local/share/doc/aria2' /usr/bin/install -c -m 644 README README.rst '/usr/local/share/doc/aria2' make[2]: Leaving directory `/root/Desktop/tools/aria2-1.17.1' make[1]: Leaving directory `/root/Desktop/tools/aria2-1.17.1'4)程序测试 在此前安装的httpd网站根目录下建立一个测试文件,比如可以将/boot/目录下vmlinuz开头的内核文件复制过去:
[root@localhost aria2-1.17.1]# cp /boot/vmlinuz-2.6.18-348.el5 /usr/local/apache/htdocs/vmlinuz.knl [root@localhost aria2-1.17.1]# ls -lh /usr/local/apache/htdocs/vmlinuz.knl -rw-r--r-- 1 root root 2.1M 09-27 17:30 /usr/local/httpd/htdocs/vmlinuz.knl 然后使用aria2c下载vmlinuz.knl文件,下载格式“aria2c 文件的URL”,若成功下载所要的文件,说明程序顺利安装并可正常使用: [root@localhost aria2-1.17.1]# cd //返回root的宿主目录 [root@localhost ~]# aria2c http://localhost/vmlinuz.knl //执行下载 09/27 17:34:04 [NOTICE] Download complete: /root/vmlinuz.knl 下载结果: gid |stat|avg speed |path/URI ======+====+===========+======================================================= 48e71e|OK | 289MiB/s|/root/vmlinuz.knl 状态标识: (OK):完成下载。 [root@localhost ~]# ls -lh vmlinuz.knl //确认下载结果 -rw-r--r-- 1 root root 2.1M 09-27 17:34 vmlinuz.knl