在startos上搭建LAMP之安装apache

一、在startos上安装安装编译环境
1.当前登录用户是cg,我想切换到root用户,不知道这一步是否必须。执行命令
su root
提示信息要求输入用户密码,我输入安装startos时设置的密码,可是仍然被提示不是正确的密码。
我更改了root用户密码,使用命令
sudo passwd
提示信息要求输入新的unix password,我输入了cg.
再执行命令su root,并输入了密码cg,成功切换到了root用户。
2.安装基本的编译环境,执行命令,是startos特有的命令
sudo yget --install build-essential
提示信息:
Install:  build-essential 
Auto-install:  make  m4  autoconf  automake  patch  intltool  pkgconfig  binutils  binutils-dev  ppl  gcc  gcc-dev  glibc-dev  glib2-dev  gdk-pixbuf-dev  linux-headers  linux-kernel-headers 
Do you want to continue [Y/n]?
输入命令Y
提示信息:
Installing make ...
Downloading http://pkg.startos.org/packages//m/make/stable/make_3.82-i686.ypk to /var/ypkg/packages/
Error: download make from http://pkg.startos.org/packages//m/make/stable/make_3.82-i686.ypk failed.
Error: installation failed.
Installing m4 ...
Downloading http://pkg.startos.org/packages//m/m4/stable/m4_1.4.16-i686.ypk to /var/ypkg/packages/
Error: download m4 from http://pkg.startos.org/packages//m/m4/stable/m4_1.4.16-i686.ypk failed.
Error: installation failed.
Installing autoconf ...
Downloading http://pkg.startos.org/packages//a/autoconf/stable/autoconf_2.68-any.ypk to /var/ypkg/packages/
Error: download autoconf from http://pkg.startos.org/packages//a/autoconf/stable/autoconf_2.68-any.ypk failed.
Error: installation failed.
skip automake ...
skip patch ...
skip intltool ...
skip pkgconfig ...
skip binutils ...
skip binutils-dev ...
skip ppl ...
skip gcc ...
skip gcc-dev ...
skip glibc-dev ...
skip glib2-dev ...
skip gdk-pixbuf-dev ...
skip linux-headers ...
skip linux-kernel-headers ...
skip build-essential ...
Failed!
再次输入:Y
仍然出现上述报错信息,看来是startos的服务器出了问题,那么我自己逐个下载
make  m4  autoconf  automake  patch  intltool  pkgconfig  binutils  binutils-dev  ppl  gcc  gcc-dev  glibc-dev  glib2-dev  gdk-pixbuf-dev  linux-headers  linux-kernel-headers 
这些软件
3.在startos的软件包服务器 http://pkg.startos.org/packages/m/make/上下载了make,
用startos的特有离线安装命令安装make
命令:sudo ypkg --install make_3.82-i686.ypk
提示信息:
Installing make_3.82-i686.ypk ...
Checking dependency tree... done
Reading package information... done
Executing pre_install script
... done
Copying files... done
Updating database... done
Executing post_install script
... install info: make.info-2.gz make.info-1.gz make.info.gz
done
Installation successful.
成功了,但是不知道安装到哪里去了。
4.从http://pkg.startos.org/packages/m/m4/m4_1.4.16-i686.ypk下载m4,执行命令
sudo ypkg --install m4_1.4.16-i686.ypk
5.直接在线安装http://pkg.startos.org/packages/a/autoconf/autoconf_2.68-any.ypk
命令:sudo yget --install http://pkg.startos.org/packages/a/autoconf/autoconf_2.68-any.ypk
失败,提示信息
Error: http://pkg.startos.org/packages/a/autoconf/autoconf_2.68-any.ypk not found.
先下载,执行命令
wget http://pkg.startos.org/packages/a/autoconf/autoconf_2.68-any.ypk
成功。安装,命令:
sudo ypkg --install autoconf_2.68-any.ypk
成功。
6.命令
sudo yget --install build-essential
提示信息:
Installing automake ...
Downloading http://pkg.startos.org/packages//a/automake/stable/automake_1.11.1-any.ypk to /var/ypkg/packages/
Error: download automake from http://pkg.startos.org/packages//a/automake/stable/automake_1.11.1-any.ypk failed.
Error: installation failed.
Installing patch ...
Downloading http://pkg.startos.org/packages//p/patch/stable/patch_2.6.1-i686.ypk to /var/ypkg/packages/
Error: download patch from http://pkg.startos.org/packages//p/patch/stable/patch_2.6.1-i686.ypk failed.
Error: installation failed.
Installing intltool ...
Downloading http://pkg.startos.org/packages//i/intltool/stable/intltool_0.41.1-i686.ypk to /var/ypkg/packages/
Error: download intltool from http://pkg.startos.org/packages//i/intltool/stable/intltool_0.41.1-i686.ypk failed.
Error: installation failed.
Installing pkgconfig ...
Downloading http://pkg.startos.org/packages//p/pkgconfig/stable/pkgconfig_0.26-i686.ypk to /var/ypkg/packages/
Error: download pkgconfig from http://pkg.startos.org/packages//p/pkgconfig/stable/pkgconfig_0.26-i686.ypk failed.
Error: installation failed.
Installing binutils ...
Downloading http://pkg.startos.org/packages//b/binutils/stable/binutils_2.22-r1-i686.ypk to /var/ypkg/packages/
Error: download binutils from http://pkg.startos.org/packages//b/binutils/stable/binutils_2.22-r1-i686.ypk failed.
Error: installation failed.
Installing binutils-dev ...
Downloading http://pkg.startos.org/packages//b/binutils-dev/stable/binutils-dev_2.22-r1-i686.ypk to /var/ypkg/packages/
Error: download binutils-dev from http://pkg.startos.org/packages//b/binutils-dev/stable/binutils-dev_2.22-r1-i686.ypk failed.
Error: installation failed.
Installing ppl ...
Downloading http://pkg.startos.org/packages//p/ppl/stable/ppl_0.12-i686.ypk to /var/ypkg/packages/
Error: download ppl from http://pkg.startos.org/packages//p/ppl/stable/ppl_0.12-i686.ypk failed.
Error: installation failed.
Installing gcc ...
Downloading http://pkg.startos.org/packages//g/gcc/stable/gcc_4.6.3-r3-i686.ypk to /var/ypkg/packages/
Error: download gcc from http://pkg.startos.org/packages//g/gcc/stable/gcc_4.6.3-r3-i686.ypk failed.
Error: installation failed.
skip gcc-dev ...
skip glibc-dev ...
skip glib2-dev ...
skip gdk-pixbuf-dev ...
skip linux-headers ...
skip linux-kernel-headers ...
skip build-essential ...
Failed!
7.重新一个一个手动安装。-----------sudo ypkg --install 
automake  patch  intltool  pkgconfig  binutils  binutils-dev  ppl  gcc  gcc-dev  glibc-dev  glib2-dev  gdk-pixbuf-dev  linux-headers  linux-kernel-headers
发现,之前已经安装过的没有出现在这个清单中。
automake
http://pkg.startos.org/packages/a/automake1.4/automake1.4_1.4-p6-i686.ypk
出错:Error: database is locked.(此错误产生的原因是:我执行了另一个安装命令,此命令要求我做出选择,而我没有,此命令一直在等待选择。不知这是LINUX的普遍机制还是startos特有机制)
先skip automake
patch--成功,重新安装automake--成功
​http://pkg.startos.org/packages/p/patch/patch_2.6.1-i686.ypk​
 intltool
http://pkg.startos.org/packages/i/intltool/intltool_0.41.1-i686.ypk​
pkgconfig
http://pkg.startos.org/packages/p/pkgconfig/pkgconfig_0.26-i686.ypk​
binutils
http://pkg.startos.org/packages/b/binutils/binutils_2.22-r1-i686.ypk​
binutils-dev 
http://pkg.startos.org/packages/b/binutils-dev/binutils-dev_2.22-r1-i686.ypk​
ppl
http://pkg.startos.org/packages/p/ppl/ppl_0.12-i686.ypk​​
gcc
http://pkg.startos.org/packages/g/gcc/gcc_4.6.3-r3-i686.ypk​​
剩下的这些需要安装gcc-dev  glibc-dev  glib2-dev  gdk-pixbuf-dev  linux-headers  linux-kernel-headers
-----------sudo ypkg --install ​
gcc-dev
http://pkg.startos.org/packages/g/gcc-dev/gcc-dev_4.6.3-r3-i686.ypk​
glibc-dev
http://pkg.startos.org/packages/g/glibc-dev/glibc-dev_2.14-r2-i686.ypk​​
glib2-dev
http://pkg.startos.org/packages/g/glib2-dev/glib2-dev_2.30.3-ylmf1-i686.ypk​
gdk-pixbuf-dev 
http://pkg.startos.org/packages/g/gdk-pixbuf-dev/gdk-pixbuf-dev_2.24.1-r1-i686.ypk​​
linux-headers
http://pkg.startos.org/packages/l/linux-headers/linux-headers_3.4.6-any.ypk​​
linux-kernel-headers
http://pkg.startos.org/packages/l/linux-kernel-headers/linux-kernel-headers_3.4.6-r2-i686.ypk
build-essential
http://pkg.startos.org/packages/b/build-essential/build-essential_20121122-any.ypk​​​​
二、安装apache
1.从下面网址获得源码包
apache
http://apache.dataguru.cn//httpd/httpd-2.4.7.tar.gz
apr
http://apache.dataguru.cn//apr/apr-1.5.0.tar.gz
APR-util​​
http://apache.dataguru.cn//apr/apr-util-1.5.3.tar.gz​
pcre
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
apr iconv(非必须,但是我想安装它,也不知道它有什么用)
http://apache.dataguru.cn//apr/apr-iconv-1.2.1.tar.gz​
2.将上述源码包解压后,切换到root用户,建好LAMP目录.下列所有步骤都是以root身份进行。
进入apr源码包目录,执行命令
./configure --prefix=/home/cg/Apps/LAMP/apache/apr
make
make install
进入apr-util目录,执行命令
./configure --prefix=/home/cg/Apps/LAMP/apache/apr-util
提示信息:
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
将上述命令修改为
./configure --prefix=/home/cg/Apps/LAMP/apache/apr-util   --with-apr=/home/cg/Apps/LAMP/apache/apr
提示信息的最后部分:
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
将上述命令修改为
./configure --prefix=/home/cg/Apps/LAMP/apache/apr-util   --with-apr=/home/cg/Apps/LAMP/apache/apr/
提示信息的最后部分:
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
检查后发现,apr的安装目录有误,上面命令中的with-apr的目录是错误的。
重新将apr安装到计划好的目录,进入apr的源码包目录,执行命令:
./configure --prefix=/home/cg/Apps/LAMP/apache/apr
make
make install
​安装apr-util,执行命令
./configure --prefix=/home/cg/Apps/LAMP/apache/apr-util   --with-apr=/home/cg/Apps/LAMP/apache/apr​
提示信息的最后部分:
rm: cannot remove `libtoolT': No such file or directory
config.status: executing default commands
config.status: include/apr.h is unchanged
config.status: include/arch/unix/apr_private.h is unchanged
configure: WARNING: unrecognized options: --with-apr
不知是什么意思。继续执行命令:
make;make install
进入apr iconv源码包,执行命令
./configure --prefix=/home/cg/Apps/LAMP/apache/apr-iconv
提示信息:
checking for gawk... gawk
checking for a BSD-compatible install... /usr/bin/install -c
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
将上述命令修改为:
./configure --prefix=/home/cg/Apps/LAMP/apache/apr-iconv --with-apr=/home/cg/Apps/LAMP/apache/apr
make;make install
进入pcre的源码目录,执行命令
./configure --prefix=/home/cg/Apps/LAMP/apache/pcre
make;make install
进入apache源码安装包,执行命令:
./configure --prefix=/home/cg/Apps/LAMP/apache/apache
--with-apr=/home/cg/Apps/LAMP/apache/apr
--with-apr-util=/home/cg/Apps/LAMP/apache/apr-util
--with-pcre=/home/cg/Apps/LAMP/apache/pcre
--with-apr-iconv=/home/cg/Apps/LAMP/apache/apr-iconv

--enable-so
--enable-rewrite
--enable-deflate
--enable-session
上述命令要直接在终端输入,若从这里复制过去的话,会被当成多条命令执行。
提示信息的最后部分:
checking whether to enable mod_deflate... checking dependencies
checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
从中得出结论:enable mod_deflate需要依赖zlib,下载zlib
http://zlib.net/zlib-1.2.8.tar.gz
将它安装到默认位置,进入zlib的源码包,执行命令:
./configure
make;make install
再次执行命令:
./configure --prefix=/home/cg/Apps/LAMP/apache/apache
--with-apr=/home/cg/Apps/LAMP/apache/apr
--with-apr-util=/home/cg/Apps/LAMP/apache/apr-util
--with-pcre=/home/cg/Apps/LAMP/apache/pcre
--with-apr-iconv=/home/cg/Apps/LAMP/apache/apr-iconv

--enable-so
--enable-rewrite
--enable-deflate
--enable-session

make;make install
上述命令要直接在终端输入,若从这里复制过去的话,会被当成多条命令执行。
提示信息中没有异常信息,apache可能安装成功了。这说明,将zlib安装到默认目录后,加载deflate模块时不必指定zlib的目录。
测试apache是否安装成功,进入apachectl所在目录,执行命令
./apachectl -k start
提示信息:
AH00543: httpd: bad user name daemon
修改了httpd.conf中的Group\User配置,
User cg
Group cg
重新启动apache后,提示信息:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.101. Set the 'ServerName' directive globally to suppress this message
在浏览器输入 http://192.168.1.101/,提示信息“It works!",说明apache已经安装成功了。
在httpd.conf中增加
ServerName:http://localhost:80
后,消除了上面的信息。
至此,apache完全安装成功了!










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值