Debian webszerver telepítése és konfigurálása
Ebben a cikkben bemutatásra kerül az egyik legjobb webszervernek való operációs rendszer telepítése és konfigurálása.
Ez nem más mint a Debian Linux.
Akkor Menjünk végig lépésről lépésre a folyamaton:
1. Első lépésként töltsük le a legfrissebb Debian Linux disztribúciót a debian.org webhelyről! Ha ez megvan, írjuk ki egy cd-re vagy pendrive-ra, és boot-oljuk be róla. Ekkor szemünk elé kerül az 1.képen látható felület. ENTER az Install feliratra!
Ezt követően kell kiválasztani a nyelvet!(2. kép)
Következő lépésben a telepítő betölti a továbbiakban szükséges modulokat.(3.kép)
Adjuk meg a gép nevét(4.kép), és tartománynevét(5.kép).
Kérni fogja a telepítő a root felhasználó jelszavát, és létre fogunk hozni egy új felhasználót magunknak. Értelem szerűen kitöltjük a kért mezőket!
Egy kis várakozás után indul a particionáló modul. Itt javaslom, hogy ha van rá lehetőség, hogy egy lemezt szenteljünk az operációs rendszernek, és válasszuk az irányított – egész lemez használata opciót!(7.kép)
Válasszuk ki a lemezt(8.kép), amire telepíteni szeretnénk, és hagyjuk jóvá a telepítő számára a particionálást!(9.kép)
Következő lépésben ki kell választani a frissítési tükörszervert (10.kép)! Válasszuk Németországot, mert ott előbb találhatóak meg a frissítések mint a mi szervereinken. Következő lépésben tetszés szerint választható akármelyik című szerver!
Következő lépésben megadhatjuk a proxy szervert ha van, ha nincs, hagyjuk üresen!(11.kép)
A szoftver választásnál csak a standard system utilities maradjon becsillagozva!(12.kép)
Amennyiben más operációs rendszer nincs a gépre telepítve, válasszuk az igen opciót! És ha végzett a telepítő, indítsuk újra a gépet!
Most, hogy az alap rendszert feltelepítettük, jöhetnek a kiszolgáló és egyéb modulok!
2. Először is, hogy ne kelljen folyamatosan a szerver előtt ülni, durrantsunk fel egy SSH szervert, hogy tudjuk távolról is konfigurálni a szerverünket!
Jelentkezzünk be a root felhasználóként a telepítés idejére!
Telepítsük az ssh szervert:
apt-get install ssh openssh-server
Most már távolról is elérhető a szerverünk! Én Linux terminál alól fogok dolgozni, de Windows alól kiválóan használható a Putty nevű program!
Linux alól a következő paranccsal tudunk belépni, ha van telepítve az ssh-client (ssh felhasználó@ipcím):
ssh root@192.168.x.x
A konfigurálást tehát ssh-n keresztül folytatjuk! (Az SSH olyan mintha a szerver előtt ülnénk, ugyan úgy a szerver terminálján tudunk dolgozni!)
3. Elsőként feltelepítjük a vim szerkesztőt, ami gyakorlatilag egy notepad csak Linux terminálon! Ez a későbbiekben hasznos lesz, amikor a konfigurációs fájlokat szerkesztjük!
apt-get install vim-nox
4. Következő lépésben konfiguráljuk a hálózati interfészt:
vi /etc/network/interfaces
A következőnek kell a fájlban szerepelnie (Vim használata):
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface #allow-hotplug eth0 #iface eth0 inet dhcp auto eth0 iface eth0 inet static address 192.168.0.100 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1
Értelem szerűen az IP címeket a saját címekre kell állítani!
Újraindítjuk a hálózati interfészt:
/etc/init.d/networking restart
Most a host fájlban állítjuk be az IP címünket:
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.100 proba.hu proba # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Adjuk meg a szerver nevét:
echo proba.hu > /etc/hostname
/etc/init.d/hostname.sh start
Ha most megnézzük a
hostname
paranccsal, akkor a proba.hu domaint írja majd ki!
5. Következő lépésben győződjön meg arról, hogy a / etc / apt / sources.list tartalmazza a debian-squeeze adattárat.
vi /etc/apt/sources.list
deb http://ftp.debian.org/debian squeeze-updates main
Ha ezt a sort nem találjuk, illesszük be a fájl legvégére!
Ezután egyből frissítsük is a rendszert:
apt-get update
apt-get upgrade
6. Ezután telepítsük a network time protocol-t! Ez hasznos, mert a szerver ezen keresztül tudja lekérni a pontos időt!
apt-get install ntp ntpdate
7. Most telepítjük a kiszolgálóprogramok egy részét(Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter és binutils):
apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 rkhunter binutils sudo
Csomag konfigurációk:
General type of mail configuration: — Internet Site
System mail name: — proba.hu
New password for the MySQL “root” user: — rootmysqljelszó
Repeat password for the MySQL “root” user: — rootmysqljelszó
Create directories for web-based administration? — Nem
SSL certificate required — Ok
Nyissuk meg a MySql konfig fájlt:
vi /etc/mysql/my.cnf
És a következő sor elé rakjunk “#”-et (bind-address):
[...] # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. #bind-address = 127.0.0.1 [...]
MySql újraindítása:
/etc/init.d/mysql restart
8. A telepítés során az SSL tanúsítványok IMAP-SSL és POP3-SSL jönnek létre localhost néven. Ezeket törölni kell és megváltoztatni a megfelelő host névre (proba.hu).
cd /etc/courier
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem
Host név megváltoztatása:
vi /etc/courier/imapd.cnf
[...] CN=proba.hu [...]
vi /etc/courier/pop3d.cnf
[...] CN=proba.hu [...]
Tanúsítványok újragenerálása:
mkimapdcert
mkpop3dcert
Courier-IMAP-SSL és Courier-POP3-SSL újraindítása:
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop-ssl restart
9. Vírus és spam védelem telepítése:
apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl
10. Webes kiszolgálók telepítése (Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, és mcrypt):
phpmyadmin konfigurálása — [*] apache2
Ha ez a csillagozás kimarad a phpmyadmin nem fog működni!!!!
apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libapache2-mod-ruby
Apache modulok engedélyezése (suexec, rewrite, ssl, actions, include) és apache újraindítása:
a2enmod suexec rewrite ssl actions include
/etc/init.d/apache2 restart
11. FTP és FTP kvóta szabályzó modul telepítése és konfigurálása:
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool
vi /etc/default/pure-ftpd-common
[...] STANDALONE_OR_INETD=standalone [...] VIRTUALCHROOT=true [...]
Szerkesszük a /etc/inetd.conf fájlt, hogy az inetd ne tudja elindítani az FTP-t:
vi /etc/inetd.conf
[...] #:STANDARD: These are standard services. #ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper [...]
Inetd újraindítása és PureFTPd indítása:
/etc/init.d/openbsd-inetd restart
/etc/init.d/pure-ftpd-mysql start
Szerkesszük a “/etc/fstab”-t:
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/sda1 / ext3 errors=remount-ro,usrquota,grpquota 0 1 /dev/sda5 none swap sw 0 0 /dev/hda /media/cdrom0 udf,iso9660 user,noauto 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
A kvóta engedélyezéséhez futtassuk a következő parancsokat:
touch /quota.user /quota.group
chmod 600 /quota.*
mount -o remount /quotacheck -avugm
quotaon -avug
12. MyDNS kiszolgáló telepítése:
Szükséges csomagok a mydns-hez:
apt-get install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev
A mydns nem található meg a Linux szoftverlistában, ezért külön kell telepíteni:
cd /tmp
wget http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.25.tar.gz
tar xvfz mydns-1.2.8.25.tar.gz
cd mydns-1.2.8
./configure
make
make install
Készítünk egy indító/leállító script-et a mydns-nek:
vi /etc/init.d/mydns
#! /bin/sh # # mydns Start the MyDNS server # # Author: Philipp Kern <phil@philkern.de>. # Based upon skeleton 1.9.4 by Miquel van Smoorenburg # <miquels@cistron.nl> and Ian Murdock <imurdock@gnu.ai.mit.edu>. # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/sbin/mydns NAME=mydns DESC="DNS server" SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 case "$1" in start) echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet \ --exec $DAEMON -- -b echo "." ;; stop) echo -n "Stopping $DESC: $NAME" start-stop-daemon --stop --oknodo --quiet \ --exec $DAEMON echo "." ;; reload|force-reload) echo -n "Reloading $DESC configuration..." start-stop-daemon --stop --signal HUP --quiet \ --exec $DAEMON echo "done." ;; restart) echo -n "Restarting $DESC: $NAME" start-stop-daemon --stop --quiet --oknodo \ --exec $DAEMON sleep 1 start-stop-daemon --start --quiet \ --exec $DAEMON -- -b echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0
Hozzáadjuk az automatikus indítási listához:
chmod +x /etc/init.d/mydns
update-rc.d mydns defaults
13. További modulok telepítése (Vlogger, Webalizer, AWstats):
apt-get install vlogger webalizer awstats
mkdir -p /usr/share/awstats/tools/
cp -prf /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/share/awstats/tools/awstats_buildstaticpages.pl
14. Jailkit telepítése(ha szeretnénk chroot ssh-t):
apt-get install build-essential autoconf automake1.9 libtool flex bison
cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz
tar xvfz jailkit-2.5.tar.gz
cd jailkit-2.5
./configure
make
make install
cd ..
rm -rf jailkit-2.5*
15. fail2ban telepítése:
Ez opcionális, de az ISPConfig használja, tehát ajánlott!
apt-get install fail2ban
16. Telepítsük a SquirrelMail-t (Webes e-mail felület):
apt-get install squirrelmail
ln -s /usr/share/squirrelmail/ /var/www/webmail
squirrelmail-configure
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. LanguagesD. Set pre-defined settings for specific IMAP servers
C Turn color on
S Save data
Q QuitCommand >> <– D
SquirrelMail Configuration : Read: config.php
———————————————————
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don’t work so
well with others. If you select your IMAP server, this option will
set some pre-defined settings for that server.Please note that you will still need to go through and make sure
everything is correct. This does not change everything. There are
only a few settings that this will change.Please select your IMAP server:
bincimap = Binc IMAP server
courier = Courier IMAP server
cyrus = Cyrus IMAP server
dovecot = Dovecot Secure IMAP server
exchange = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx = Mac OS X Mailserver
mercury32 = Mercury/32
uw = University of Washington’s IMAP serverquit = Do not change anything
Command >> <– courierSquirrelMail Configuration : Read: config.php
———————————————————
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don’t work so
well with others. If you select your IMAP server, this option will
set some pre-defined settings for that server.Please note that you will still need to go through and make sure
everything is correct. This does not change everything. There are
only a few settings that this will change.Please select your IMAP server:
bincimap = Binc IMAP server
courier = Courier IMAP server
cyrus = Cyrus IMAP server
dovecot = Dovecot Secure IMAP server
exchange = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx = Mac OS X Mailserver
mercury32 = Mercury/32
uw = University of Washington’s IMAP serverquit = Do not change anything
Command >> courierimap_server_type = courier
default_folder_prefix = INBOX.
trash_folder = Trash
sent_folder = Sent
draft_folder = Drafts
show_prefix_option = false
default_sub_of_inbox = false
show_contain_subfolders_option = false
optional_delimiter = .
delete_folder = truePress any key to continue… <– press a key
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. LanguagesD. Set pre-defined settings for specific IMAP servers
C Turn color on
S Save data
Q QuitCommand >> <– S
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. LanguagesD. Set pre-defined settings for specific IMAP servers
C Turn color on
S Save data
Q QuitCommand >> <– Q
És máris elérhető a http://192.168.0.100/webmail vagy a http://proba.hu/webmail címen.
17. ISPConfig 3 teletítése (webes konfigurációs felület):
cd /tmp
wget http://prdownloads.sourceforge.net/ispconfig/ISPConfig-3.0.4.6.tar.gztar xvfz ISPConfig-3.0.4.6.tar.gz
cd ispconfig3_install/install/php -q install.php
——————————————————————————–
_____ ___________ _____ __ _
|_ _/ ___| ___ \ / __ \ / _(_)
| | \ `–.| |_/ / | / \/ ___ _ __ | |_ _ __ _
| | `–. \ __/ | | / _ \| ‘_ \| _| |/ _` |
_| |_/\__/ / | | \__/\ (_) | | | | | | | (_| |
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, |
__/ |
|___/
——————————————————————————–>> Initial configuration
Operating System: Debian Lenny/Sid or compatible
Following will be a few questions for primary configuration so be careful.
Default values are in [brackets] and can be accepted with <ENTER>.
Tap in “quit” (without the quotes) to stop the installer.Select language (en,de) [en]: — ENTER
Installation mode (standard,expert) [standard]: — ENTER
Full qualified hostname (FQDN) of the server, eg server1.domain.tld [proba.hu]: — ENTER
MySQL server hostname [localhost]: — ENTER
MySQL root username [root]: — ENTER
MySQL root password []: — yourrootsqlpassword
MySQL database to create [dbispconfig]: — ENTER
MySQL charset [utf8]: — ENTER
Generating a 2048 bit RSA private key
……………………………………………………………………………………………………+++
……………………………………………………………………………………………+++
writing new private key to ‘smtpd.key’
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]: — ENTER
State or Province Name (full name) [Some-State]: — ENTER
Locality Name (eg, city) []: — ENTER
Organization Name (eg, company) [Internet Widgits Pty Ltd]: — ENTER
Organizational Unit Name (eg, section) []: — ENTER
Common Name (eg, YOUR name) []: — ENTER
Email Address []: — ENTER
Configuring Jailkit
Configuring SASL
Configuring PAM
Configuring Courier
Configuring Spamassassin
Configuring Amavisd
Configuring Getmail
Configuring Pureftpd
Configuring MyDNS
Configuring Apache
Configuring Firewall
Installing ISPConfig
ISPConfig Port [8080]: — ENTERConfiguring DBServer
Installing Crontab
no crontab for root
no crontab for getmail
Restarting services …
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
Stopping Postfix Mail Transport Agent: postfix.
Starting Postfix Mail Transport Agent: postfix.
Stopping SASL Authentication Daemon: saslauthd.
Starting SASL Authentication Daemon: saslauthd.
Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.
Stopping ClamAV daemon: clamd.
Starting ClamAV daemon: clamd .
Stopping Courier authentication services: authdaemond.
Starting Courier authentication services: authdaemond.
Stopping Courier IMAP server: imapd.
Starting Courier IMAP server: imapd.
Stopping Courier IMAP-SSL server: imapd-ssl.
Starting Courier IMAP-SSL server: imapd-ssl.
Stopping Courier POP3 server: pop3d.
Starting Courier POP3 server: pop3d.
Stopping Courier POP3-SSL server: pop3d-ssl.
Starting Courier POP3-SSL server: pop3d-ssl.
Restarting web server: apache2 … waiting .
Restarting ftp server: Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l mysql:/etc/pure-ftpd/db/mysql.conf -l pam -E -A -u 1000 -O clf:/var/log/pure-ftpd/transfer.log -b -BInstallation completed.
A konfigurációs felületet elérhetjük a https://proba.hu:8080/ vagy a https://192.168.0.100:8080/ címen!
A szerverünk készen van a használatra!
A leírás csak tájékoztató jellegű! Felelőséget nem vállalok!
Forrás: http://www.howtoforge.com/perfect-server-debian-lenny-ispconfig3
Kommentek
Powered by Facebook Comments