You are not logged in.
how can I set apache to bu runed as a service(auto run when i boot the server)?
config it in rc.conf?
someone help me
Offline
add something like 'apache' to the daemons line in rc.conf, then create a file called 'apache' in /etc/rc.d and set it up like the ones that are already there...
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting Apache"
add_daemon apache
# put whatever to start apache here
stat_done
;;
stop)
stat_busy "Stopping Apache"
rm_daemon apache
# end it here, ex: killall -q /usr/sbin/apache
stat_done
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
#End of file
Offline
Thanks, I try it now.
Offline
Just add httpd to the deamons array in rc.conf and you're set.
Offline
i first created the file /etc/rc.d/apache like this
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting Apache"
add_daemon apache
# put whatever to start apache here
/usr/local/apache2/bin/apachectl start
stat_done
;;
stop)
stat_busy "Stopping Apache"
rm_daemon apache
# end it here, ex: killall -q /usr/sbin/apache
/usr/local/apache2/bin/apachectl stop
stat_done
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
#End of file
and added apache daemon in /etc/rc.conf
but it said permission denied when booting
so I just added one line directly in /etc/rc.conf like this
/usr/local/apache2/bin/apachectl start
it started correctly, but, when booting the system return serval lines like this:
httpd pid xxxx is already running
please tell me why.
looking forward to your reply
Offline
just add httpd to the daemons array - what colnago suggested is unecessary
Offline
just add httpd?
but I dont have a httpd script in the path /etc/rc.d
I added "/usr/local/apache2/bin/apachestl start" into /etc/rc.conf, that led my to a danger way.
When booting it kept showing the message about httpd and never stop.
Then I booted /archCD/isolinux/vmlinuz from grub, and corrected my rc.conf.
Offline
reinstall apache pacman -S apache - did you install with pacman?
Also:
pacman -Ql apache
[snip]
apache /etc/rc.d/
apache /etc/rc.d/httpd
[snip]
pacman -Qo /etc/rc.d/httpd
/etc/rc.d/httpd is owned by apache 2.0.54-1
So it should be there and I would suggest that figuring out why it is not is the most important thing!
Offline
I installed httpd by compile it myself because I must enable so module.
I will try your way ,thanks
Offline
OK - if you install it yourself you need to get used to using abs to rebuild pkgs using the Arch method.
See http://wiki.archlinux.org/index.php/ABS … ild_System
Especially
http://wiki.archlinux.org/index.php/ABS … _a_package
This will be VERY useful to you! HTH :mrgreen:
Offline
thanks very much
Though reading english document is not a easy job for me, I'll build a package tonight.
Offline
I think you will find the reading the hardest part, building the pkg will be easy. Unfortunately we can't make it any easier... or maybe we can...
What exactly did you have to add to your apache build?
Did you have to use a special configure option or maybe some patches? I think we can make a PKGBUILD for you
Offline
I think I can manage it.
I just use --enable-so for the option, I'll simply fill the option in build section.
Do it myself, and I will learn more.
I'll ask for your guys' help if I have any problem doing it.
btw, I find arch linux a very good system, my ab test shows that apache on arch is very efficiency.
Offline
I simply compress the directory httpd-2.0.54 to httpd-2.0.54.tar.php.
And then make a PKGBUILD file as show here below:
# Contributor: fluke <fluke@ospattern.net>
pkgname=httpd
pkgver=2.0.54
pkgrel=1
pkgdesc="a powerful http server"
url="http://www.apache.org"
groups=
provides=
depends=('gcc')
makedepends=('gcc')
#conflicts=('yafoo')
#replaces=('mffoo')
#backup=('/etc/foo/foo.conf')
#install=('foo.install')
source=(./$pkgname-$pkgver.tar.gz)
md5sums=('67e280c06d7fcd8b6c35338c70a289e0')
build() {
cd $startdir/src/$pkgname-$pkgver
./configure --prefix=/usr/local/apache2 --enable-so
make || return 1
make prefix=$startdir/pkg/usr install
}
I succeeded in makepkg.
but when I pacman -U httpd.2.0.54.tar.gz, it said "loading package data... load_pkg: missing package info file in httpd-2.0.54.tar.gz".
I just wonder where should I place the pkg info?
Offline
um - i just checked -enable-so is already done in standard arch package - i don't understand the problem now
pacman -S apache
/etc/rc.d/httpd start
should give work apache server
Offline
httpd.2.0.54.tar.gz isn't a package. Arch package ends with .pkg.tar.gz. Try
pacman -U httpd-2.0.54-1.pkg.tar.gz
Offline
oh, thank you for your suggestion.
I typed ls in the path /var/abs/local, when i found httpd.2.0.54-1.pkg.tar.gz was there.
So I used pacman to install the package, but I find the "--prefix" option followed "./configure" didn't affect the path to install the package.
Then I modified my package to:
# Contributor: fluke <fluke@ospattern.net>
pkgname=httpd
pkgver=2.0.54
pkgrel=1
pkgdesc="a powerful http server"
url="http://www.apache.org"
groups=
provides=
depends=('gcc')
makedepends=('gcc')
#conflicts=('yafoo')
#replaces=('mffoo')
#backup=('/etc/foo/foo.conf')
#install=('foo.install')
source=(./$pkgname-$pkgver.tar.gz)
md5sums=('67e280c06d7fcd8b6c35338c70a289e0')
build() {
cd $startdir/src/$pkgname-$pkgver
./configure --enable-so
make || return 1
make prefix=$startdir/pkg/usr/local/apache2 install #*specify my prefix here*
}
Then it worked.
There is a question.
How can I specify my install path(--prefix=) using pacman?
You know, not everyone wants to modify his PKGBUILD and build a package himself.
Offline
You know, not everyone wants to modify his PKGBUILD and build a package himself.
It is the easiest way in Arch. If you do not wish to maintain your system correctly with pacman then why are you using Arch? If you want script to start and stop apache easily then use the original pkg. No one is forcing you to. You asked for our help - we told you the easiest way to do it.
I still fail to see the original problem. From what you have said the standard Arch pkg should have worked perfectly for you. I was going to tell you exactly how to build the pkg you wanted but when I saw the standard PKGBUILD I realized that it already had the feature your required.
So, what are we supposed to do?
Offline
I choose arch because its optimized for i686 system, and, pacman can help me install common packages for the official and many other repos servers.
And why not fedora? I think I don't like rpms, they might not fix my i686 system.
But for special softwares like apache,php,tomcat.. I'd like to compile them my self. It's just one of my habits
In my mind, only when I am to install some packages form the net I will use pacman but when I have local source files and I will compile them myself.
Are there any different things between use pacman to install a package and compile it myself?:?:
Maybe I could not yet understand the whole meaning of the pacman system.
Please don't mind about my inconsecute English. I'm trying my best to learn it.
I can learn more deep anout linux from arch linux. This is the best thing I gain these days using arch. And you've told me much.
Offline
And I still don't know if I can specify a install dir when I use pacman to install a package for the offcial package server .
Offline
You can build source and install it using pacman and makepkg. You should never need to build and install source "manually", you might want to and that is ok
The PKGBUILD you have created above is really not much use - this is the original PKGBUILD
# $Id: PKGBUILD,v 1.57 2005/04/16 18:37:54 judd Exp $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=apache
pkgver=2.0.54
pkgrel=1
pkgdesc="A high performance Unix-based HTTP server (with SSL)"
backup=(etc/httpd/conf/httpd.conf home/httpd/html/index.html
etc/conf.d/httpd etc/httpd/conf/ssl.conf)
depends=('glibc' 'gdbm' 'db' 'openssl' 'expat')
provides=('apr' 'apr-util')
conflicts=('apr' 'apr-util')
source=(http://www.apache.org/dist/httpd/httpd-$pkgver.tar.gz
httpd index.html mod_ssl.txt httpd.logrotate httpd.conf.d
httpd.conf ssl.conf)
md5sums=('772503748ffb85301385d47fb2b96eca' '077b2d9dcb7914600f5b1a3de1dec8f7'
'64206bf5da4daf4b962186ded0a3d20a' '2e68c9508d21e98c4503dcb159d22890'
'a13925eef67108cf22f6bd1b2b8decb1' '62dba8077401cb5515ecb79fe29c2a52'
'8747daec5196bdb6221f7dc334504f90' '7adfc868a67f9b16d63a9f3b074f3efa')
build() {
cd $startdir/src/httpd-$pkgver
# fix the suexec user
sed -i 's|^#define AP_HTTPD_USER.*$|#define AP_HTTPD_USER "nobody"|'
support/suexec.h
./configure --prefix=/usr --enable-layout=RedHat --datadir=/home/httpd
--enable-modules=all --enable-mods-shared=all --enable-ssl --enable-so
--enable-proxy --enable-proxy-connect --enable-proxy-ftp
--enable-proxy-http --enable-suexec
make || return 1
make DESTDIR=$startdir/pkg install
rm -f $startdir/pkg/usr/include/fnmatch.h
rm -rf $startdir/pkg/home/httpd/html/* $startdir/pkg/home/httpd/manual
install -D -m755 ../httpd $startdir/pkg/etc/rc.d/httpd
install -D -m644 ../httpd.logrotate $startdir/pkg/etc/logrotate.d/httpd
install -D -m644 ../index.html $startdir/pkg/home/httpd/html/index.html
install -D -m644 ../mod_ssl.txt $startdir/pkg/etc/httpd/conf/mod_ssl.txt
install -D -m644 ../httpd.conf.d $startdir/pkg/etc/conf.d/httpd
install -D -m644 ../httpd.conf $startdir/pkg/etc/httpd/conf/httpd.conf
install -D -m644 ../ssl.conf $startdir/pkg/etc/httpd/conf/ssl.conf
# move suexec to the right place
mv $startdir/pkg/usr/sbin/suexec $startdir/pkg/usr/bin/suexec
}
As you can see it is very different from yours.
My question is: why does the regualr Arch pkgs not work for you?
There is no way for me to tell you how to fix it if I don't know what is wrong!
Offline
Hey, you teach me so much again!
Now I understand how convenient and reliable to install package in this method.
My question is: why does the regualr Arch pkgs not work for you?
I haven't tried the regular pkg of apache because I want more flexibility. I used to use fedora, and I don't much like its yum install.
Now, as I see the PKGBUILD file myself, I believe its very professional and reliable.
There is no way for me to tell you how to fix it if I don't know what is wrong!
The problem is lack of this :install -D -m644 ../httpd.conf.d $startdir/pkg/etc/conf.d/httpd
I fixed the problem. I wrote a script to start http in daemon.
----------
I find there many beautiful pictures in your website.
Are they on fluxbox wm?
There is another problem.
I can't install other wms correctly.
I just use pacman to install them. like
pacman -S fluxbok
when I start them , return an err msg like this:
cannot open display
That is, I can only run xfce4.
these are my kde error messages:
xsetroot: unable to open display ''
xset: unable to open display ""
xset: unable to open display ""
xset: unable to open display ""
xsetroot: unable to open display ''
startkde: starting up...
startkde: Running kpersonalizer
kwin: cannot connect to C server
kpersonalizer:cannot connect to X server
kpersonalizer:cannot connect to X server
kpersonalizer:cannot connect to X server
kpersonalizer:cannot connect to X server
kpersonalizer:cannot connect to X server
...
Offline
Hey, you teach me so much again!
Now I understand how convenient and reliable to install package in this method.My question is: why does the regualr Arch pkgs not work for you?
I haven't tried the regular pkg of apache because I want more flexibility. I used to use fedora, and I don't much like its yum install.
Now, as I see the PKGBUILD file myself, I believe its very professional and reliable.There is no way for me to tell you how to fix it if I don't know what is wrong!
The problem is lack of this :install -D -m644 ../httpd.conf.d $startdir/pkg/etc/conf.d/httpd
I fixed the problem. I wrote a script to start http in daemon.
If you check out the abs (Arch Build System) tree you can find all of the necessary files for building standard. First you need to get some tools:
$ pacman -Sy cvsup wget
the run abs simply by
$ abs
When that is done take a look in /var/abs/daemons/apache
Offline
I get it now.
and, i know arch team now is developing a rewind(return to the status before install a package, I don't know if I use the word rewind is correct, because I saw this news in a chinese site, I don't have the news in English) feature for pacman, I want to know more about it.
Offline
Hmmm, rewind is ok but "rollback" is the commonly used term. Some of the GUI pacman frontends such as Jacman already feature rollback functions - I am not aware of plans for integration into the offical version
Offline