開發(fā)板上搭建lighttpd環(huán)境
要在開發(fā)板上搭建lighttpd環(huán)境,首先要在ubuntu上搭建交叉編譯環(huán)境,然后對lighttpd的源碼進(jìn)行編譯,最后將編譯好的文件和配置文件拷貝到開發(fā)板上,就可以運(yùn)行了。
1、在ubuntu下搭建交叉編譯環(huán)境
1) 將開發(fā)板提供的gcc拷貝到ubuntu環(huán)境下,如我本地拷貝完后的bin目錄為:
/home/acer/source/arm-gcc/fsl-linaro-toolchain/bin/
2) 配置ubuntu的環(huán)境變量文件:
我的ubuntu版本是10.04,打開/etc/bash.bashrc文件,然后在文件末尾增加環(huán)境變量。
網(wǎng)上通用配置都包括如下一句
export PATH=/opt/liunx/arm-gcc/fsl-linaro-toolchain/bin:$PATH
但是因?yàn)殚_發(fā)板不同,我的還要增加如下幾句:
export ARCH=arm
export CROSS_COMPILE=/home/acer/source/arm-gcc/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-
配置完成后,保存文件
3)重新加載環(huán)境變量:
source /etc/bash.bashrc
4)驗(yàn)證交叉編譯環(huán)境,我的會輸出如下提示:
acer@ace:~/lighttpd/lighttpd-1.4.18$ arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/opt/liunx/arm-gcc/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper
Target: arm-fsl-linux-gnueabi
Configured with: /work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --disable-nls --enable-c99 --enable-long-long --with-system-zlib
Thread model: posix
gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20)
至此,交叉編譯環(huán)境搭建完畢
2、ubuntu上編譯lighttpd
我的lighttpd版本為1.4.18,可以自己去lighttpd官網(wǎng)上下載。
1)配置configure命令
首先進(jìn)入lighttpd安裝文件夾下
cd /home/acer/lighttpd/lighttpd1.4.18
./configure --prefix=/lighttpd --host=arm-linux --build=i486-linux-gnu --disable-FEATURE -disable-ipv6 -diable-lfs
2)編譯
make
3)構(gòu)建
創(chuàng)建/lighttpd文件夾(同configure中的prefix跟的路徑),然后授權(quán),最后在lighttpd的安裝文件夾下構(gòu)建
sudo mkdir /lighttpd
sudo chmod 777 /lighttpd
cd /home/acer/lighttpd/lighttpd1.4.18
make install
上述三步運(yùn)行完之后,在/lighttpd下會生成lib、bin、sbin、share四個文件夾,這就是要拷貝到開發(fā)板上的文件。
3、開發(fā)板,創(chuàng)建目錄,同時拷貝文件到開發(fā)板:
1)創(chuàng)建根目錄/lighttpd(同編譯時configure命令中的prefix后跟的路徑),授予權(quán)限
mkdir /lighttpd
chmod 777 /lighttpd
然后將ubuntu上/lighttpd中的四個文件夾lib、bin、sbin、share拷貝到開發(fā)板的/lighttpd下,具體什么方式,自己定吧,我們使用tftp考的的,在此不冗述。
2)創(chuàng)建web根目錄/htdocs
mkdir /htdocs
chmod 777 /htdocs
3)創(chuàng)建日志保存目錄/var/log/lighttpd
mkdir /var/log/lighttpd
chmod 777 /var/log/lighttpd
4、配置并拷貝配置文件到開發(fā)板
在ubuntu的lighttpd安裝文件中,找到lighttpd.config文件
cd /home/acer/lighttpd/lighttpd1.4.18/doc
打開lighttpd.config,作如下修改:
server.document-root = "/htdocs/"
server.errorlog = "/var/log/lighttpd/error.log"
然后注釋掉:
#$HTTP["url"] =~ "\.pdf$" {
# server.range-requests = "disable"
#}
保存后,將lighttpd.config拷貝到開發(fā)板的/etc/目錄下,至此,已經(jīng)配置完成
5、啟動lighttpd
在開發(fā)板上運(yùn)行:
/lighttpd/sbin/lighttpd -f /etc/lighttpd.conf
然后將一個.html文件放到/htdocs文件夾下,訪問web服務(wù)器試下吧!
參考文件:
http://www.linuxidc.com/Linux/2011-09/43619.htm
http://www.linuxidc.com/Linux/2013-06/85902.htm
http://blog.163.com/ljf_gzhu/blog/static/131553440201211522317367/
1、在ubuntu下搭建交叉編譯環(huán)境
1) 將開發(fā)板提供的gcc拷貝到ubuntu環(huán)境下,如我本地拷貝完后的bin目錄為:
/home/acer/source/arm-gcc/fsl-linaro-toolchain/bin/
2) 配置ubuntu的環(huán)境變量文件:
我的ubuntu版本是10.04,打開/etc/bash.bashrc文件,然后在文件末尾增加環(huán)境變量。
網(wǎng)上通用配置都包括如下一句
export PATH=/opt/liunx/arm-gcc/fsl-linaro-toolchain/bin:$PATH
但是因?yàn)殚_發(fā)板不同,我的還要增加如下幾句:
export ARCH=arm
export CROSS_COMPILE=/home/acer/source/arm-gcc/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-
配置完成后,保存文件
3)重新加載環(huán)境變量:
source /etc/bash.bashrc
4)驗(yàn)證交叉編譯環(huán)境,我的會輸出如下提示:
acer@ace:~/lighttpd/lighttpd-1.4.18$ arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gcc
COLLECT_LTO_WRAPPER=/opt/liunx/arm-gcc/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper
Target: arm-fsl-linux-gnueabi
Configured with: /work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --disable-nls --enable-c99 --enable-long-long --with-system-zlib
Thread model: posix
gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20)
至此,交叉編譯環(huán)境搭建完畢
2、ubuntu上編譯lighttpd
我的lighttpd版本為1.4.18,可以自己去lighttpd官網(wǎng)上下載。
1)配置configure命令
首先進(jìn)入lighttpd安裝文件夾下
cd /home/acer/lighttpd/lighttpd1.4.18
./configure --prefix=/lighttpd --host=arm-linux --build=i486-linux-gnu --disable-FEATURE -disable-ipv6 -diable-lfs
2)編譯
make
3)構(gòu)建
創(chuàng)建/lighttpd文件夾(同configure中的prefix跟的路徑),然后授權(quán),最后在lighttpd的安裝文件夾下構(gòu)建
sudo mkdir /lighttpd
sudo chmod 777 /lighttpd
cd /home/acer/lighttpd/lighttpd1.4.18
make install
上述三步運(yùn)行完之后,在/lighttpd下會生成lib、bin、sbin、share四個文件夾,這就是要拷貝到開發(fā)板上的文件。
3、開發(fā)板,創(chuàng)建目錄,同時拷貝文件到開發(fā)板:
1)創(chuàng)建根目錄/lighttpd(同編譯時configure命令中的prefix后跟的路徑),授予權(quán)限
mkdir /lighttpd
chmod 777 /lighttpd
然后將ubuntu上/lighttpd中的四個文件夾lib、bin、sbin、share拷貝到開發(fā)板的/lighttpd下,具體什么方式,自己定吧,我們使用tftp考的的,在此不冗述。
2)創(chuàng)建web根目錄/htdocs
mkdir /htdocs
chmod 777 /htdocs
3)創(chuàng)建日志保存目錄/var/log/lighttpd
mkdir /var/log/lighttpd
chmod 777 /var/log/lighttpd
4、配置并拷貝配置文件到開發(fā)板
在ubuntu的lighttpd安裝文件中,找到lighttpd.config文件
cd /home/acer/lighttpd/lighttpd1.4.18/doc
打開lighttpd.config,作如下修改:
server.document-root = "/htdocs/"
server.errorlog = "/var/log/lighttpd/error.log"
然后注釋掉:
#$HTTP["url"] =~ "\.pdf$" {
# server.range-requests = "disable"
#}
保存后,將lighttpd.config拷貝到開發(fā)板的/etc/目錄下,至此,已經(jīng)配置完成
5、啟動lighttpd
在開發(fā)板上運(yùn)行:
/lighttpd/sbin/lighttpd -f /etc/lighttpd.conf
然后將一個.html文件放到/htdocs文件夾下,訪問web服務(wù)器試下吧!
參考文件:
http://www.linuxidc.com/Linux/2011-09/43619.htm
http://www.linuxidc.com/Linux/2013-06/85902.htm
http://blog.163.com/ljf_gzhu/blog/static/131553440201211522317367/
posted on 2015-03-19 11:08 聽風(fēng) 閱讀(804) 評論(0) 編輯 收藏 所屬分類: 嵌入式