Apache, PHP, MySQL and Samba
Apache, PHP, MySQL and Samba
Can someone who know this write a 100% complete guide on how to install Apache, PHP, MySQL and Samba after a completely fresh (ie. first boot) Pro 1.1 install, WITHOUT any graphical interface (xfree, xfce, etc). I have tried several times now, and it fucked up every time.
Quick Hint,
You need to edit /etc/make.conf and change the USE variable to exclude stuff like XFree, e.g. USE="-X". This will tell gentoo to NOT compile those optional extra GUI frontends that require XFree86.
See http://www.gentoo.org/doc/en/portage-manual.xml for more details. See /usr/portage/profiles/use.desc for a listing of keywords / apps.
HTH,
Rich
You need to edit /etc/make.conf and change the USE variable to exclude stuff like XFree, e.g. USE="-X". This will tell gentoo to NOT compile those optional extra GUI frontends that require XFree86.
See http://www.gentoo.org/doc/en/portage-manual.xml for more details. See /usr/portage/profiles/use.desc for a listing of keywords / apps.
HTH,
Rich
-
- Gentoox Guru!
- Posts: 1681
- Joined: Sun Sep 28, 2003 11:59 am
- Location: Manchester, UK
-
- Gentoox Guru!
- Posts: 1681
- Joined: Sun Sep 28, 2003 11:59 am
- Location: Manchester, UK
In this tutorial it is assumed you have a virgin gentoox pro install with a working Internet connection, since it is a tutorial for the pro edition, it is also assumed that you know how to switch to the root user and how to edit text files. The tutorial was updated on 24th January 2005 and uses the latest versions of the programs available in portage marked as stable on that date, it will probablly work with earlier and later versions but I cannot gaurentee that. The versions I installed were:-
mysql 4.0.22-r2
samba 3.0.10
Apache 2.0.52-r1
PHP 4.3.10
mod_php 4.3.10
First up we need to set the use variable in /etc/make.conf if you are starting, like me, with a virgin 1.5 pro install then then you only need add -qt -gtk -gnome -kde to prevent xfree being compiled with php, if you have changed your at any point make sure you have mysql, apache2 and samba in the list. If you don't need cups (printing) support then you can add -cups to the list to prevent it being compiled as a dependency of samba. I also added -sdl due to a new use flag on lib-compat.
Then we'll emerge the packages, we'll update portage while we are at it.
Apache and php are dependencies of mod_php so it is not necessary to emerge them seperatley although it won't make any difference if you do. On my standard installation (non-native) with a 1Mbps Internet connection it took around 5 hours to emerge the packages including an emerge sync.
I have arranged the configuration section in the order the packages are installed, this means you can configure each package as soon as it is installed whilst the system is compiling the other packages.
Configuring MYSQL (mysql was compiled and installed after approx 2 hours)
First we need to run the mysql_install_db script for this to run you need to be able to look up the IP address of your xbox from the hostname with resolveip. You get the hostname by typing hostname at a prompt, the default for a Pro install is Pro. To allow the IP address to be resolved from the hostname with resolveip we need to add an entry to /etc/hosts mapping the hostname to the IP address. If your IP might change use 127.0.0.1 then we can get on with the configuration.
your should replace xbox with a password of your choice and Pro with the hostname of your xbox, after the second mysqladmin command you will be prompted for a password, this should be the same as the password you gave in the first mysqladmin command.
Now we will set up one database which can be used by phpBB
Lastly we'll add mysql to the default run level so it starts when gentoox boots
That's it for mysql now on to Samba
Configuring Samba (Samba was compiled and installed after approx 2hrs 45mins)
I won't go in to Samba configuration too much as I consider the example config file to be more than adequate at explaining the basics with more advanced stuff available in the docs online at http://www.samba.org
Start by copying the example file into place, this gives you a good template. Then run testparm to see what you need to change
This is what you get
you will also want to add some shares add a section like
That gives you a share of the whole rootfs one for the root of the apache webserver and one for your E drive check that you haven't made any mistakes with the testparm command and start the server and add it to the default run level to make it start on boot
If you want to tidy up your smb.conf an easy way to do it is to run testparm then copy the output into nano
Now we need to add some samba users, we'll add two one for each of the default gentoox users.
You should use the same passwords for samba users as you have set for gentoox users (defaults are xbox)
That's Samba done, on to apache
Apache configuration
Before you can configure apache you must wait until mod_php is compiled since it is invoked at start up
First off edit /etc/apache2/conf/apache2.conf uncomment the servername and change it to the name of your server, the server name is the fully qualified domain name of your server, if you were setting up a server to serve http://www.mynewwebsite.com you would put that as your server name.
Next it's a good idea for a server serving php pages that we change the directory index page order so the server looks for index.php before index.html this is changed in /etc/apache2/conf/commonapache2.conf find the line and change it to read
The Apache ebuilds are a bit broken and don't create a few folders they need to so we'll make them ourselves, here's one to hold the log files.
If you do want SSL support you will need to sort out your certificates, first define the Apache optionsnext you'll need to create a self signed certificate and key, this would normally be done by the ebuild but more broken directoriesYou can fill in as many or as few of the fields as you wish, enter a . for fields you want to leave blank. You should enter something for the common name field, this should be the same as your server name.
Then fire up apache and add it to the default run level
Check Apache is up and running by pointing your browser to http://xbox_ip_address you should get the apache welcome page. Delete all these so your server is ready for your own pages
new pages can be put in /var/www/localhost/htdocs this can be accessed from your windows PCs on the network in \\xbox\http-root
To make sure mysql mod_php and apache are all playing together we'll install phpBB as this uses all three
point your browser to http://xbox_ip_address/phpBB/install/install.php
change database type to MySQL 4.x
fill in localhost for DSN
phpbb for database name
root for database user
and the password you used in the mysql configuration for database password
Fill in the admin config section then click start install
Click finish installation
delete the install and contrib directories
refresh your browser
One word of warning, phpBB is now installed using web-app config, this is apparently a good thing, but I am too lazy to learn what it means or how to use it. With web apps I recommend grabbing the source from the author and installing it yourself.
All done
Edited for updates required by broken apache ebuilds
mysql 4.0.22-r2
samba 3.0.10
Apache 2.0.52-r1
PHP 4.3.10
mod_php 4.3.10
First up we need to set the use variable in /etc/make.conf if you are starting, like me, with a virgin 1.5 pro install then then you only need add -qt -gtk -gnome -kde to prevent xfree being compiled with php, if you have changed your at any point make sure you have mysql, apache2 and samba in the list. If you don't need cups (printing) support then you can add -cups to the list to prevent it being compiled as a dependency of samba. I also added -sdl due to a new use flag on lib-compat.
Then we'll emerge the packages, we'll update portage while we are at it.
Code: Select all
emerge sync && emerge -av portage mysql samba mod_php
I have arranged the configuration section in the order the packages are installed, this means you can configure each package as soon as it is installed whilst the system is compiling the other packages.
Configuring MYSQL (mysql was compiled and installed after approx 2 hours)
First we need to run the mysql_install_db script for this to run you need to be able to look up the IP address of your xbox from the hostname with resolveip. You get the hostname by typing hostname at a prompt, the default for a Pro install is Pro. To allow the IP address to be resolved from the hostname with resolveip we need to add an entry to /etc/hosts mapping the hostname to the IP address. If your IP might change use 127.0.0.1 then we can get on with the configuration.
Code: Select all
mysql_install_db
/etc/init.d/mysql start
mysqladmin -u root -h Pro password 'xbox'
mysqladmin -u root password 'xbox' -p
Now we will set up one database which can be used by phpBB
Code: Select all
mysql -p
create database phpbb;
quit
Code: Select all
rc-update add mysql default
Configuring Samba (Samba was compiled and installed after approx 2hrs 45mins)
I won't go in to Samba configuration too much as I consider the example config file to be more than adequate at explaining the basics with more advanced stuff available in the docs online at http://www.samba.org
Start by copying the example file into place, this gives you a good template. Then run testparm to see what you need to change
Code: Select all
rm /etc/samba/smb.conf && cp /etc/samba/smb.conf.example /etc/samba/smb.conf
testparm
You need to edit /etc/samba/smb.conf and add a netbios name I'm going to use xbox so I add a line in the [global] section that says/etc/smb.conf wrote:[global]
server string = Samba Server %v
map to guest = Bad User
log file = /var/log/samba3/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
printcap name = cups
dns proxy = No
printer admin = @adm
printing = cups
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
guest ok = Yes
printable = Yes
print command = lpr-cups -P %p -o raw %s -r # using client side printer drivers.
browseable = No
[print$]
path = /var/lib/samba/printers
write list = @adm, root
guest ok = Yes
Code: Select all
netbios name = xbox
Code: Select all
[root]
path = /
writeable = yes
[http-root]
path = /var/www/localhost/htdocs
writeable = yes
[E-Drive]
path = /mnt/fatx/e
writeable = yes
Code: Select all
testparm
/etc/init.d/samba start
rc-update add samba default
Now we need to add some samba users, we'll add two one for each of the default gentoox users.
Code: Select all
smbpasswd -a root
smbpasswd -a gentoox
That's Samba done, on to apache
Apache configuration
Before you can configure apache you must wait until mod_php is compiled since it is invoked at start up
First off edit /etc/apache2/conf/apache2.conf uncomment the servername and change it to the name of your server, the server name is the fully qualified domain name of your server, if you were setting up a server to serve http://www.mynewwebsite.com you would put that as your server name.
Next it's a good idea for a server serving php pages that we change the directory index page order so the server looks for index.php before index.html this is changed in /etc/apache2/conf/commonapache2.conf find the line
Code: Select all
DirectoryIndex index.html index.html.var index.php index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm
Code: Select all
DirectoryIndex index.php index.html.var index.html index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm
Code: Select all
mkdir /var/log/apache2
Code: Select all
echo "APACHE2_OPTS="-D SSL -D PHP4"" >> /etc/conf.d/apache2
Code: Select all
mkdir /etc/apache2/conf/ssl
mkdir /var/cache/apache2
cd /etc/apache2/conf/ssl/
/usr/lib/ssl/apache2-mod_ssl/gentestcrt.sh
Then fire up apache and add it to the default run level
Code: Select all
/etc/init.d/apache2 start
rc-update add apache2 default
Code: Select all
rm -rf /var/www/localhost/htdocs/*
To make sure mysql mod_php and apache are all playing together we'll install phpBB as this uses all three
Code: Select all
echo www-apps/phpBB\ ~x86 >> /etc/portage/package.keywords
emerge phpBB
change database type to MySQL 4.x
fill in localhost for DSN
phpbb for database name
root for database user
and the password you used in the mysql configuration for database password
Fill in the admin config section then click start install
Click finish installation
delete the install and contrib directories
Code: Select all
rm -rf /var/www/localhost/htdocs/phpBB/install /var/www/localhost/htdocs/phpBB/contrib
One word of warning, phpBB is now installed using web-app config, this is apparently a good thing, but I am too lazy to learn what it means or how to use it. With web apps I recommend grabbing the source from the author and installing it yourself.
All done
Edited for updates required by broken apache ebuilds
Last edited by nobspangle on Mon Jan 24, 2005 8:53 pm, edited 1 time in total.
-
- Gentoox Guru!
- Posts: 1681
- Joined: Sun Sep 28, 2003 11:59 am
- Location: Manchester, UK
Excellent HOWTO, nobspangle!
I'd like to share my experience with this. I started with a near vanilla pro 1.1 install. Before starting this HOWTO, I had run "magic" to get all patches, except XFree (and things that need XFree). After all updates were done (including a kernel rebuild, and forced "sync"), I did an "emerge Apache". This crapped out with a "caught signal 1" after a while. I had no idea why, as I did nothing to instigate it. Hence on a whim I stopped fanctl, and started it manually, setting speed to 80% with "fanctl -f 80". After that no further unexpected quitting....
I also did a couple of extra things which may be benefical:
1) In /etc/make.conf I set the following*:
MAKEOPTS="-j2"
PORT_LOGDIR="/var/log/emerge"
*the lines were already there, they just needed uncommenting, and changing slightly. Then I created that directory: mkdir /var/log/emerge
This (IMHO) allows for each build to be captured in its own log file, and also permitted 2 compile jobs to be run at once, potentially speeding up the process.
2) I also enabled "ccache" (instructions on http://www.gentoo.org in portage manual, in section 2.3 or thereabouts), but since I didn't have to recompile anything again after making the fanctl change, it didn't gain me much -- some 200 files found as a "cache-hit" in near 4000 compiled]
My build order was slighty different, as didn't want to watch the whole thing, yet also didn't want to confuse myself by doing too many things at once (slow and sure is best...). Hence I did:
emerge apache
emerge perl
emerge samba
emerge mod_php
So what were my results?
I haven't tried samba shares yet, but the rest works.
However I had some issues testing phpBB. For my install (different versions?), I needed to change the instructions a little:
A] where the HOWTO said point your browser to http://xbox_ip_address/phpbb, I need to use http://xbox_ip_address/phpBB/install/install.php
B] where the HOWTO said to delete the install and contrib directories (for phpBB), I needed to do:
rm -rf /var/www/localhost/htdocs/phpBB/install /var/www/localhost/htdocs/phpBB/contrib
{Note: captialization of "phpbb" changed to "phpBB" to match filesystem}
Hopefully this gives n00b's like myself confidence to give it a shot! All in all pretty easy for building from source.
Cheers!
UPDATE: Check out my post on page 2, for how things go on GentooX Home 4.0. Thanks again, to nobspangle!
I'd like to share my experience with this. I started with a near vanilla pro 1.1 install. Before starting this HOWTO, I had run "magic" to get all patches, except XFree (and things that need XFree). After all updates were done (including a kernel rebuild, and forced "sync"), I did an "emerge Apache". This crapped out with a "caught signal 1" after a while. I had no idea why, as I did nothing to instigate it. Hence on a whim I stopped fanctl, and started it manually, setting speed to 80% with "fanctl -f 80". After that no further unexpected quitting....
I also did a couple of extra things which may be benefical:
1) In /etc/make.conf I set the following*:
MAKEOPTS="-j2"
PORT_LOGDIR="/var/log/emerge"
*the lines were already there, they just needed uncommenting, and changing slightly. Then I created that directory: mkdir /var/log/emerge
This (IMHO) allows for each build to be captured in its own log file, and also permitted 2 compile jobs to be run at once, potentially speeding up the process.
2) I also enabled "ccache" (instructions on http://www.gentoo.org in portage manual, in section 2.3 or thereabouts), but since I didn't have to recompile anything again after making the fanctl change, it didn't gain me much -- some 200 files found as a "cache-hit" in near 4000 compiled]
My build order was slighty different, as didn't want to watch the whole thing, yet also didn't want to confuse myself by doing too many things at once (slow and sure is best...). Hence I did:
emerge apache
emerge perl
emerge samba
emerge mod_php
So what were my results?
I haven't tried samba shares yet, but the rest works.
However I had some issues testing phpBB. For my install (different versions?), I needed to change the instructions a little:
A] where the HOWTO said point your browser to http://xbox_ip_address/phpbb, I need to use http://xbox_ip_address/phpBB/install/install.php
B] where the HOWTO said to delete the install and contrib directories (for phpBB), I needed to do:
rm -rf /var/www/localhost/htdocs/phpBB/install /var/www/localhost/htdocs/phpBB/contrib
{Note: captialization of "phpbb" changed to "phpBB" to match filesystem}
Hopefully this gives n00b's like myself confidence to give it a shot! All in all pretty easy for building from source.
Cheers!
UPDATE: Check out my post on page 2, for how things go on GentooX Home 4.0. Thanks again, to nobspangle!
Last edited by Krazy on Sat Aug 13, 2005 4:11 am, edited 1 time in total.
-
- Gentoox Guru!
- Posts: 1681
- Joined: Sun Sep 28, 2003 11:59 am
- Location: Manchester, UK
Glad you liked the howto, strange differences on phpbb, I wrote the tutorial whilst compiling the stuff onto a fresh install of pro. They must have changed the phpBB install directory from phpbb to phpBB.Krazy wrote:A] where the HOWTO said point your browser to http://xbox_ip_address/phpbb, I need to use http://xbox_ip_address/phpBB/install/install.php
B] where the HOWTO said to delete the install and contrib directories (for phpBB), I needed to do:
rm -rf /var/www/localhost/htdocs/phpBB/install /var/www/localhost/htdocs/phpBB/contrib
{Note: captialization of "phpbb" changed to "phpBB" to match filesystem}
If you keep an open mind, will your brain fall out?
-
- Gentoox Guru!
- Posts: 553
- Joined: Tue Oct 07, 2003 9:57 pm
- Location: MOUNT TAPE U1439 ON B3, NO RING
You have to use -a whole bunch of things. Run emerge -v [progname] to get some ideas.bdonkey wrote:I tried following your excellent tutorial on 1.3d, but xfree is still being compiled. Any help?
And I've already tried adding -X to the USE line in make.conf, but that didn't change anything.
MOUNT TAPE U1439 ON B3, NO RING
Q: HOW DO I RUN MAGIC ??
A: You run magic by not typing in capital letters.
Q: HOW DO I RUN MAGIC ??
A: You run magic by not typing in capital letters.
-
- Gentoox Guru!
- Posts: 1681
- Joined: Sun Sep 28, 2003 11:59 am
- Location: Manchester, UK