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.
Code: Select all
emerge sync && emerge -av portage mysql samba mod_php
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.
Code: Select all
mysql_install_db
/etc/init.d/mysql start
mysqladmin -u root -h Pro password 'xbox'
mysqladmin -u root password 'xbox' -p
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
Code: Select all
mysql -p
create database phpbb;
quit
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
Code: Select all
rm /etc/samba/smb.conf && cp /etc/samba/smb.conf.example /etc/samba/smb.conf
testparm
This is what you get
/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
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
you will also want to add some shares add a section like
Code: Select all
[root]
path = /
writeable = yes
[http-root]
path = /var/www/localhost/htdocs
writeable = yes
[E-Drive]
path = /mnt/fatx/e
writeable = yes
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
Code: Select all
testparm
/etc/init.d/samba start
rc-update add samba default
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.
Code: Select all
smbpasswd -a root
smbpasswd -a gentoox
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
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
and change it to read
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
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 options
Code: Select all
echo "APACHE2_OPTS="-D SSL -D PHP4"" >> /etc/conf.d/apache2
next you'll need to create a self signed certificate and key, this would normally be done by the ebuild but more broken directories
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
You 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
Code: Select all
/etc/init.d/apache2 start
rc-update add apache2 default
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
Code: Select all
rm -rf /var/www/localhost/htdocs/*
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
Code: Select all
echo www-apps/phpBB\ ~x86 >> /etc/portage/package.keywords
emerge phpBB
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
Code: Select all
rm -rf /var/www/localhost/htdocs/phpBB/install /var/www/localhost/htdocs/phpBB/contrib
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