You are on page 1of 15

Database Server

From MEPIS Documentation Wiki


Jump to: navigation, search
[edit]

MySQL5
1. Installing mysql5 with apt-get:
apt-get install mysql5
(in case you are having dependency problems try to use Debian snapshot repository.
2. Initialize the database:
mysql_install_db
3. Start sql server by:
mysqld_safe
4. Test it by:
mysqlshow
5. Set up user password:
mysql -u root
6. Check MySQL configuration file /etc/mysql/my.cnf for additional settings.
[edit]

MySQL5 Installation from source


Get the latest binary tarball from http://www.mysql.org. At the time of this writing, 18 May
2005, it is "mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz" You will be asked to select a
mirror, then using either http or ftp download the tarball to your default download location. A
password was not set for this demo, an obvious hole that should be corrected on your own
installation.
# mv [download_location]/mysql-standard-5.0.4-beta-pc-linux-gnu-
i686.tar.gz /usr/local/src/mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz
# cd /usr/local/src
# tar -xvzf mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz
The directory /usr/local/src/mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz is created.
# ln -s /usr/local/src/mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz
/usr/local/mysql
# cd /usr/local/mysql
# groupadd mysql
# useradd -g mysql mysql
# ./scripts/mysql_install_db --user=mysql
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
Setup MySQL so it starts on boot.
# cp ./support-files/mysql.server /etc/init.d/mysql
# ln -s /etc/init.d/mysql /etc/rc5.d/S99mysql
# ln -s /etc/init.d/mysql /etc/rc0.d/K01mysql
Copy the configuration file to the system directory, pick the one that is appropriate; for testing
the medium model was used
# cp ./support-files/my-medium.cnf /etc/my.cnf
Test the MySQL installation
# ./support-files/mysql.server start
# cd /tmp (verify that mysql.sock exists)
# cd /usr/local/mysql
# ./bin/mysql
You should see a MySQL welcome notification and a version number. While still in the MySQL
environment, type the lines shown below. This will be used to verify the PHP installation later
on. The semicolon at the end of each line is required.
> use test;
> create table t1(c1 int);
> insert into t1 values(125);
> quit
Using your favorite editor change the PATH definition in the following files, [I don't know if
both are needed - someone please correct] :
/etc/profile
/etc/bashrc
The definition is: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/
sbin:/usr/local/mysql/bin:/usr/games
Now reboot and MySQL should start. Verify by:
# ps -A | grep mysql
If there are several items returned then it is running. If the list is blank then revisit the section
above where links were made in the rc0.d and rc5.d directories.

DNSmasq
Although Bind9, and enterprise-grade, industry-standard DNS server, is available in the
repositories, it is also next-to-impossible for mere humans to understand. If you are setting up a
DNS server at home, chances are you just want to be able to refer to your home computers by
name instead of remembering IP's or keeping up with a /etc/hosts file on every computer.
In this scenario you can set up DNSmasq on your server. DNSmasq is available in the
repositories, so you can install thus:
apt-get install dnsmasq
Once installed, DNSmasq uses the local /etc/hosts file to serve up name resolution information
on your network. Alternately, you can use a separate file that uses the same syntax.
Once you have installed DNSmasq and edited the server's /etc/hosts file, you need to configure
all your clients to use it. You can do this by putting an entry in /etc/resolv.conf:
nameserver <ip of dnsmasq server>
Put this as the first nameserver entry, then your normal DNS server (usually provided by your
ISP) as the second.

What is an FTP Server?


An FTP server is a server which runs over the File Transfer Protocol. It is a very common
protocol which has been used for almost as long as HTTP for transfering files over the internet
and between nodes in networks.
There are many different servers that can be used on the linux operating system including pure-
ftp, vsftp, proftp, wsftp etc...
[edit]

Installing vsftp
Here I will show you how to use vsftp both for use as a daemon process (running all the time)
and as an entry in inetd which, using inetd.conf spawns the daemon when a connection is
requested, saving a users system resources and cpu cycles while the server is not in use.
I personally use vsftp because it is very secure, fast, and simple to configure.
apt-get install vsftpd - will download the daemon and begin to run it in that mode. It will also add
startup scripts to your rc*.d folders, so the daemon will start each time you boot.
the configuration can be found in /etc/vsftpd.conf and can be edited freely. If you wish to run it in
inetd, simply comment out or remove listen=YES and add this to your /etc/inetd.conf.
#:FTP
ftp stream tcp nowait root /usr/sbin/vsftpd vsftpd
Options
some of the options I personally use are as follows -
write_enable=YES //alows users write access
anon_root=/home/ftp //anonymous users root
anonymous_enable=YES //allows use of anonymous users
local_enable=YES //allows unix users on the box to login to their home folders
connect_from_port_20=YES //allows port 20 connections (ftp-control)
idle_session_timeout=6000 //session timeout in SECONDS
ftpd_banner=Welcome to my FTP. Behave! //displays to users using ftp clients
For passive mode
pasv_enable=YES //passive mode, enables passive connections (using a seperate port for data
transfer)
pasv_min_port=64990
pasv_max_port=65000
Other Options
all of the options can be found at http://vsftpd.beasts.org/vsftpd_conf.html
note: Using inetd is not a good idea if more then a couple people will be using vsftp at the same
time, it has been known to become unstable.
[edit]

Installing ProFTP
ProFTP is another good FTP server. Info: ProFTP project, features
It can be installed with this command:
apt-get install proftpd
After the installation you should be able to log in using usernames and passwords available on
the computer.
If you want to allow anonymous logins look in configuration file /etc/proftpd/proftpd.conf and
uncomment the required lines.
The installation place a start link in the appropriate runlevel, therefore ProFTP will start each
time the computer boots. To start/stop the server you can use these commands (as root):
/etc/init.d/proftpd start
/etc/init.d/proftpd stop
/etc/init.d/proftpd restart

LAMP with MySQL5 and PHP 5


From MEPIS Documentation Wiki
Jump to: navigation, search
Installing MySQL5 and PHP5 on Mepis --SJ_Mathews 20:31, 10 Jun 2005 (EDT)
Mepis 3.3 provides us with a working copy of Apache2 to experiment with. We are halfway
home for the installation of LAMP. This post will describe installing the final two components;
MySQL5 and PHP5. The goal is to create an experimental / learning environment that allows
experimentation with a local database-driven web-site using server-side PHP scripts.
WARNING: This installation assumes that a previous edition of MySQL does not exist. If it does
then follow the upgrade installation instructions found at mysql.org
Note: the syntax for this message equals:
# = issue these commands in a root shell
> = issue these commands in a mysql5 shell
[] = data to be optionally changed for a user specific location
Otherwise it is just a general note or observation or plea for a better way.
Begin MySQL5 Install:
Get the latest binary tarball from http://www.mysql.org. At the time of this writing, 18 May
2005, it is "mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz" You will be asked to select a
mirror, then using either http or ftp download the tarball to your default download location. A
password was not set for this demo, an obvious hole that should be corrected on your own
installation.
# mv [download_location]/mysql-standard-5.0.4-beta-pc-linux-gnu-
i686.tar.gz /usr/local/src/mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz
# cd /usr/local/src
# tar -xvzf mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz
The directory /usr/local/src/mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz is created.
# ln -s /usr/local/src/mysql-standard-5.0.4-beta-pc-linux-gnu-i686.tar.gz
/usr/local/mysql
# cd /usr/local/mysql
# groupadd mysql
# useradd -g mysql mysql
# ./scripts/mysql_install_db --user=mysql
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
Setup MySQL so it starts on boot.
# cp ./support-files/mysql.server /etc/init.d/mysql
# ln -s /etc/init.d/mysql /etc/rc5.d/S99mysql
# ln -s /etc/init.d/mysql /etc/rc0.d/K01mysql
Copy the configuration file to the system directory, pick the one that is appropriate; for testing
the medium model was used
# cp ./support-files/my-medium.cnf /etc/my.cnf
Test the MySQL installation
# ./support-files/mysql.server start
# cd /tmp [ verify that mysql.sock exists ]
# cd /usr/local/mysql
# ./bin/mysql
You should see a MySQL welcome notification and a version number. While still in the MySQL
environment, type the lines shown below. This will be used to verify the PHP installation later
on. The semicolon at the end of each line is required.
> use test;
> create table t1(c1 int);
> insert into t1 values(125);
> quit
Using your favorite editor change the PATH definition in the following files, [I don't know if
both are needed - someone please correct] :
/etc/profile
/etc/bashrc
The definition is: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/
sbin:/usr/local/mysql/bin:/usr/games
Now reboot and MySQL should start. Verify by:
# ps -A | grep mysql
If there are several items returned then it is running. If the list is blank then revisit the section
above where links were made in the rc0.d and rc5.d directories.
Begin PHP5 install:
Get the latest source tarball from http://www.php.net At this time it is "php-5.0.4.tar.gz"
Download the tarball to your default location.
# mv [default_location]/php-5.0.4.tar.gz /usr/local/src/php-5.0.4.tar.gz
# cd /usr/local/src
# tar -xvzf php-5.0.4.tar.gz
The directory /usr/local/src/php-5.0.4 is created. Because there are such a plethora of choices in
the configuration of PHP5 we are going to create a little shell file that controls the flags for us.
# cd ./php-5.0.4
Using your favorite editor create the file as shown below, if you want to add more flags type:
./configure --help | less
at the prompt. The shared objects approach to LAMP was used, thus the --with-apxs2 line is
included. More on that in the next step or two.
#!/bin/sh
./configure \
--with-apxs2=/usr/bin/apxs2 \
--with-mysql=/usr/local/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--enable-ftp
Save the file as 'php5-install' in the current directory. Any unique name will do, just substitute
that name in the next steps.
# chmod 755 php5-install
Normally we would run the script now, but my first attempt generated a multitude of errors.
These boiled down to missing packages. Here is what needed to be installed. These resolved
errors around the apxs2 file, lexical parsers and problems with XML
# apt-get install apache2-prefork-dev bison flex libxml2 libxml2-dev libxml2-
utils
Now we should be able to run the configuration script.
# ./php5-install
Sit back and enjoy the show, if all goes well a success message will appear, if not try Googleing
the error to see what package may be needed. And please post it here.
# make
# make install
These two steps will take a while, but we are getting close to the end. Next copy the php.ini file
into the correct location. There are two choices, the one shown is for development and
experimentation. php.ini-recommended is for production. Read the top of each file to see which
one is better for your use.
# cp php.ini-dist /usr/local/lib/php.ini
Begin re-configure of Apache2
Apache2 needs to be reconfigured to use PHP5, if restarted now it would try to use both PHP4
and PHP5.
# cd /etc/apache2
Edit the file httpd.conf in this directory, remove the line 'LoadModule php5_module
/usr/lib/apache2/modules/libphp5.so" or comment it out by inserting a # in front of it. This
directive will be installed in the next step using the Apache2 Available / Enabled mechanism.
# cd ./mods-available
# cp php4.conf php5.conf
# cp php4.load php5.load
Edit both php5.conf and php5.load replacing any instance of a 4 with a 5 - These are the new
directive files we need for Apache2
# cd ../mods-enabled
# cp ../mods-available/php5.conf .
# cp ../mods-available/php5.load .
# rm php4.conf
# rm php4.load
Note if you ever want to switch back to PHP4 then just do the previous cp and rm steps but
change 5's to 4's and 4's to 5's
We are done! restart the Apacehe2 server and give it a test.
# apache2ctl stop
# apache2ctl start
Open a browser and navigate to http://localhost/phpinfo.php if all went well you should see a
PHP information screen showing PHP 5.0.4 at the top, and scrolling down you should see
information regarding MySQL in the display.
And now for a quick test of PHP5 actually talking to MySQL5. Create the following file in
/var/www as "mytest.php"
<?php
$user=;
$pass=;
$host='localhost';
$dbase='test';
echo "Before connect to Mysql in PHP<br>";
$sql = mysql_connect($host, $user, $pass) or die (mysql_error());
mysql_select_db($dbase, $sql) or die (mysql_error());
echo "After connect to Mysql in PHP<br>";
$result = mysql_query("select * from t1");
$row = mysql_fetch_array($result);
echo "Return value = ".$row[0]."<br>";
mysql_close($sql);
echo "Goodbye!";
?>

Navigate to http://localhost/mytest.php. The return value shown should be 125. Have fun!
Retrieved from "http://www.mepis.org/docs/en/index.php/LAMP_with_MySQL5_and_PHP_5"

LTSP Server
From MEPIS Documentation Wiki
Jump to: navigation, search
Intructions to set up Mepis LTSP from scratch
FPRIVATE "TYPE=PICT;ALT=One Mepis laptop can run 20 client laptops! "

LTSP is an add-on package for Linux that allows you to connect lots of low-powered thin client
terminals to a Linux server. Applications run on the server and accept input and display their
output on the thin client display. LTSP is available as a set of packages that can be installed on
any Linux system. Example of usage
Hardware for a 20 seat system

· One decent laptop or desktop (P4 or better)+ 2 network cards.

· Extra ram (1 Gig is OK 2 is better)

· Up to 20 'obsolete' laptops or desktops with network cards

· 20 port gigabit switch.

· 22 lengths of cat 5 cable.

Contents
[hide]

· 1 Server

· 2 Finding Device IDs and MAC addresses

· 3 Setting up a client for PXE (network card) boot

· 4 Setting up a client for floppy disk boot


[edit]

Server
First install 2 network cards and install Mepis then open a command line and type;
su
'Your root password'
update-rc.d -f guarddog remove
apt-get install ltsp-utils dhcp3-server atftpd portmap nfs-kernel-server
Say 'OK' to dhcp being non-authorative. Say 'NO' to the portmap question. When prompted to
configure dhcpd only listen on eth1, when prompted to configure atfpd use the default answer to
all questions.
rm /etc/dhcp3/dhcpd.conf
update-rc.d -f dhcp3-server remove
update-rc.d dhcp3-server start 20 2 3 4 5 . stop 1 6 .
su -
ltspadmin
Go through the following options on the ltspadmin screen:
a) Select the second option; - configure installer options. Say yes/default to all.
b) Select the first option; - install; press a to select all components. press q to install ltsp. (this
will take a while)
c) Select the third option - configure; Work through steps 1-11 in the last section as below;

1. Leave as it is.
2. Leave as it is.
3. yes to auto-generate config file.
4. ok
5. ok
6. yes to enable
7. yes to enable kdm, no to disable graphical (This section often does not work for enabling
XDMCP and reports that it is NOT working when it actually IS).
8. yes to creating hosts
9. yes to creating host.allow
10. yes to creating exports
11. yes to creating lts.conf file
Make sure you fix the dhcpd.conf as described here on the LTSP wiki (it should be ok by
default)

select an interface for your LTSP connections. You can do this by adding the following in;
nano /etc/network/interfaces
auto eth1
iface eth1 inet static
address 192.168.0.254
netmask 255.255.255.0
then;
ifdown eth1
ifup eth1
Will bring up the interface (and to activate it with your new settings). then;
apt-get remove kdm
apt-get install gdm
nano /etc/X11/gdm/gdm.conf

In the file /etc/X11/gdm/gdm.conf search for the line 'the security of xdmcp' (type <ctrl>+<W>
'the security of xdmcp') change the line below it to 'enable=true' Reboot the machine
[edit]
Finding Device IDs and MAC addresses
PCI IDs are two 4 digit hexadecimal numbers with a ':' between them. The first number is a
'manufacturer ID', e.g.

· 10ec = Realtek

· 10b7 = 3Com
The second for is the 'device ID' specific to particular devices. Example:

· 10ec:8139' is a Realtek 8139 card

· 10b7:9058' is a 3com 905b card


They look a bit different when you get to the www.rom-o-matic.net site, like this;

· 0x10ec,0x8139

· 0x10b7,0x9058.
You need to find the PCI ID to make an Etherboot image to either put on a floppy or a ROM.
You can find both the PCI ID and the Mac address at the same time with a live CD
On the client machine using MEPIS live cd run;
lspci
and then
lspci -n
this will allow you to match up the network card with it's device ID tell you the device ID. While
you are there, you can use
ifconfig -a
to reveal the MAC address of the card too.
Here is an example of the output of lspci and lspci -n:
ben@watasenia:~$ lspci
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo
KT266/A/333]
0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333
AGP]
0000:00:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-
8139/8139C/8139C+ (rev 10)
0000:00:0a.0 Multimedia audio controller: Yamaha Corporation YMF-724 (rev 05)
0000:00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)
0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge
0000:00:11.1 IDE interface: VIA Technologies, Inc.
VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus
Master IDE (rev 06)
0000:01:00.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2
MX/MX 400] (rev b2)
ben@watasenia:~$ lspci -n
0000:00:00.0 0600: 1106:3099
0000:00:01.0 0604: 1106:b099
0000:00:08.0 0200: 10ec:8139 (rev 10)
0000:00:0a.0 0401: 1073:0004 (rev 05)
0000:00:10.3 0c03: 1106:3104 (rev 82)
0000:00:11.0 0601: 1106:3177
0000:00:11.1 0101: 1106:0571 (rev 06)
0000:01:00.0 0300: 10de:0110 (rev b2)
In this example the ethernet controller has a device ID of 10ec:8139 and it's a Realtek
Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
[edit]

Setting up a client for PXE (network card) boot


· find the MAC address of the network card

· add to the '/etc/dhcp3/dhcpd.conf' file the DHCP entry on the server machine. This will
include the MAC, IP, hostname, location of the kernel. You should add IP addresses
starting at 192.168.0.10 as below. Where /path/to/boot/image will be whatever 2.6 kernel
is in tftpboot/lts/2.6whatever/pxelinux.0
host ws001 {
hardware ethernet 00:11:22:33:44:55;
fixed-address 192.168.0.10;
filename "/path/to/boot/image";
}

· restart dhcp3 server using /etc/init.d/dhcp3-server restart

· you may need to edit /opt/ltsp/etc/lts.conf to help the client through a difficult boot.

· WRITE THE MAC ADDRESS ON THE CLIENT, FOR EASY INSTALL WHEN IT'S
BEING ADDED TO SOMEONES LTSP SET UP.
[edit]

Setting up a client for floppy disk boot


· Plug in client to server

· find the PCI ID of the network card in the machine you are using.

· go to http://www.rom-o-matic.net and select latest release

· select network controller with the right vendor and device and ID

· Select '.zdsk' in the image type box

· Click on the "configure" link

· put -1 in ASK_BOOT
· Click on "get ROM" to retrieve your boot image

· save the file you get

· insert floppy into the server machine (to make a floppy for your client)
cat eb-5.4.1-nameoffile.zdsk > /dev/fd0
(this will make the floppy into an etherboot floppy)

· insert floppy into the client machine set the BIOS to boot from floppy

· find the MAC address of the network card (this will be revealed when the floppy boots
and finds the card)

· add to the '/etc/dhcp3/dhcpd.conf' file the DHCP entry. This will include the MAC, IP,
hostname, location of the kernel. You should add IP addresses starting at 192.168.0.10 as
below. Where /path/to/boot/image will be whatever 2.6 kernel is in
/tftpboot/lts/2.6whatever/lts
host ws001 {
hardware ethernet 00:11:22:33:44:55;
fixed-address 192.168.0.10;
filename "/path/to/boot/image";
}

· restart dhcp3 server using /etc/init.d/dhcp3-server restart

· you may need to edit /opt/ltsp/etc/lts.conf to help the client through a difficult boot.

· WRITE THE MAC ADDRESS ON THE CLIENT, FOR EASY INSTALL WHEN IT'S
BEING ADDED TO SOMEONES LTSP SET UP.

NX Server
From MEPIS Documentation Wiki
Jump to: navigation, search
NoMachine NX is a Terminal Server and Remote Access solution based on a comprising set of
enterprise class open source technologies. Thanks to the outstanding compression, session
resilience and resource management developed on top of the X-Window system, and the
integration with the powerful audio, printing and resource sharing capabilities of the Unix world,
NoMachine NX makes it possible to run any graphical application on any operating system
across any network connection as if you were sitting in front of your computer. (from nomachine
site)

Contents
[hide]
· 1 NX Server installation

· 2 Starting a session

· 3 NX Server control

· 4 Quality issue

· 5 Connectivity issues
[edit]

NX Server installation
To install it download nxclient, nxnode, and nxserver packages from Nomachine site
Install the downloaded packages with: "dpkg -i *.deb" or by using Kpackage.
Fix needed for version 2.1.0-7 and lower (might be required for newer version too) : edit
/usr/NX/etc/node.cfg file and add this:
AGENT_EXTRA_OPTIONS_X = "-fp
/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/
75dpi/,/usr/share/X11/fonts/100dpi"
[edit]

Starting a session
You can run the NX client from:
/usr/NX/bin/nxclient
You can connect to an NX server by specifying the server IP address and using the uername and
password on that sytem, make sure the firewall doesn't block port 22 and make sure the sshd is
running on the server machine, if not you can start it with:
/etc/init.d/ssh start
To make sure it starts everytime you boot run this command:
update-rc.d ssh defaults
[edit]

NX Server control
The NX server should start at boot up, you can stop it with this command:
/etc/init.d/nxserver stop
You can permanently remove it from starting with this command:
update-rc.d -f nxserver remove
You can still start it manually with this command:
/etc/init.d/nxserver start
[edit]

Quality issue
If the fonts appear in different colors and they look unclear do this:
go to "Configure" on the NX client
select "use custom settings"
Click "Modify" and select "Disable the render extension"
[edit]

Connectivity issues
Your computer should have either a real IP address, or if it uses NAT, your have to forward
the port used by the remote access programs to the local IP address assigned to your
computer.
Make sure your firewall doesn't block the port 22 that's used for remote connections.
Make sure that your IP address doesn't change, if you don't have control over it, try the free
Dynamic DNS service offered by http://www.dyndns.com
Retrieved from "http://www.mepis.org/docs/en/index.php/NX_Server"
Category: Servers

You might also like