Install the complete HTTP FTP MAIL of the code, Linux Server
The rookie took a linux server for about two months, including kernel / apache2 / php (gd) / mysql / qmail (SMTP user authentication) / pureftp, etc., now give everyone to share, please go to http: / / www.garhee.com/bbs/ 's Linux Forum Question (Repost Alley)
1, install Linux and compile the Linux kernel
First go to redhat.com to download Linux 7.3, and Kernel.org download required Linux kernel version
Why choose 7.3? Because of simple, integrated things, I only need HTTP FTP MySQL Mail, and in order to carry forward DIY spirit, I have all software installed from the source code.
When installing Linux, be careful not to install your things
To kernel.org to download the Kernel code package you need, I downloaded 2.4.20 25 I didn't compile it on Linux7.3. I don't know which heroes are compiled, and I will drive my forum http: // www. Garhee.com/bbs/ Tell me, thank you!
Enter the directory of the Linux kernel code, change the extraversion = minikernel in the Makefile file, and copy the Config file of the source code of the Linux kernel0 installed in the installed, and use the redhat to execute the following command to execute the following command to use the Config file provided by Redhat. : Make Menuconfigmake Dep
Make BzimageMake Modulesmake Modules_Install
When make menuconfig, you can remove these unnecessary things: Plug and Play configurationTelephony SupportIEEE 1394 (FireWire) support (EXPERIMENTAL) Amateur Radio supportIrDA (infrared) supportISDN subsystemMultimedia devicesSoundUSB supportBluetooth support
Other subsections, please readers yourself to reduce the kernel size, and remember to save the config file you know yourself.
Since I use the SCSI (AIX79xx) hard disk, I downloaded the latest version of the drive AIC79xx-2.0.2-source.tar.gz to http://adaptec.com, overwrite the Drivers / SCSI / AIC79xx directory, and compile.
In this way, the hard disk has been turned over, and it is finally completed. The execution is completed, which step is step: cp arch / i386 / boot / bzimage /boot/vmlinuz-2.4.20minikerNelcp vmlinux /Boot/VMLinux-2.4.20minikerNelcp System .map /boot/system.map-2.4.20minikernel
CD / lib / modulesmkinitrd / boot/initrd-2.4.20minikernel.img 2.4.20minikernel
At this time, you copy to the / boot directory, change /boot/grub/grub.conf or /etc/lilo.conf, add a startup project to compile the new kernel. If LILO is started, there is also an execution / sbin / lilo -v. You can choose the new kernel after restart.
In addition, be sure to disable Telnet with ntsysv, use SSH
Reference article: "Talking about Linux Security" http://www.phpx.com/index.php?itemid=227"linux SSH Cooperate SecureCrt's Key Perfect Usage "http://www.5ilinux.com/ssh01 .html2, install Apache2
To apache.org Download the latest Apache2 version, decompressed and execute: ./ Configure --prefix = / server / apache2 --enable-so / - enable-mods-shared = Mostmakemake Install
Reference article: "Apache static / dynamic compile in Apache PHP MySQL Application" http://www.5ilinux.com/apache01.html
3, install mysql
To mysql.com download, compile command: ./ configure --prefix = / server / mysqlmakemake install Add a line in /etc/ld.so.conf: / server / mysql / lib / mysql Execute LDConfig
4, install PHP GD ZLIB Freetype2 MMCache
FreeType2 to http://www.freetype.org/ Download the latest version of freetype2, compile command: ./ Configure --prefix = / server / freetype2makemake install
Zlib to http://www.zlib.org/ or http://www.gzip.org/zlib/ Download the latest version of ZLIB, compile command: ./ Configure --Prefix = / Server / Zlibmakemake Install
GD to http://www.boutell.com/gd/ Download the latest version ./configure --prefix = / server / gdlib / - with-png = / usr / - with-jpeg = / usr / - with -Freetype = / server / freetypemakemake install Add a line in /etc/ld.so.conf: / Server / GDLIB / LIB Execute LDConfig
PHP to PHP.net download php4, I can't use MMCache when I installed MMCache, I don't know it ./configure --prefix = / server / php / - with-config-file-path = / server / PHP / ETC / - with-mysql = / server / mysql / - with-apxs2 = / server / Apache2 / bin / apxs / - with-gd = / server / gdlib / - enable-gd-native-ttf / Enable-GD-IMGSTTTF / - WITH-JPEG-DIR = / USR / LIB / - with-PNG-DIR = / usr / lib / - with-zlib-Dir = / Server / Zlib / - with-freetype -dir = / server / freetype2
Mmcache to http://turck-mmcache.sourceforge.net download export php_prefix = "/ server / php" $ PHP_PREFIX / BIN / PHPIZE. / Configure --Nable-mmcache = shared --with-php-config = $ PHP_PREFIX / BIN / PHP-ConfigmakeMake Install Add: extension = "/ server / php / lib / php / extensions / mmcache.so" mmcache.shm_size = "16" mmcache.cache_dir = "/ TMP / MMCache "mmcache.enable =" 1 "mmcache.optimizer =" 1 "mmcache.check_mtime =" 1 "mmcache.debug =" 0 "mmcache.filter =" "mmcache.shm_max =" 0 "mmcache.shm_ttl =" 0 "MMCache .SHM_PRUNE_PERIOD = "0" mmcache.shm_only = "0" mmcache.compress = "1" built directory: MKDIR / TMP / MMCachechMod 0777 / TMP / MMCache Reference article: "PHP weapon" http://www.phpx. COM / INDEX.PHP? ItemId = 237
5, install qmail to http://www.qmail.org/ Download QMAIL latest version and ucspi-tcp daemontools to http://www.inter7.com/ Download VPopmail QMAILADMIN SQWWwebmail latest version
QMAIL installation document qmail http://www.lifewithqmail.org/lwq.html#installation-issussucspi http://cr.yp.to/ucspi-tcp.htmldaemontools http://cr.yp.to/daemontools.html
Install UCSPI-TCP: Makemake Setup Check
Install DEAMONTOOLS: Package / INSTALL
MKDIR / VAR / QMAILGROUPADD NOFILESUSERADD QMAILD -G NOFILES -D / VAR / QMAIL -S / BIN / FALSEUSERADD ALIAS -G NOFILES -D / VAR / QMAIL / Alias -S / BIN / FALSEUSERADD QMAILL -G NOFILES -D / VAR / QMAIL -s / bin / falseuseradd qmailp -g nofiles -d / var / qmail -s / bin / falsegroupadd qmailUseradd qmailq -g qmail -d / var / qmail -s / bin / falseUseRadd qmailr -g qmail -d / var / qmail - S / BIN / FALSEUSERADD qmails -g qmail -d / var / qmail -s / bin / false
Make setup check
Generate file / var / qmail / rc #! / Bin / sh # using stdout for logging # Using control / defaultdelivery from qmail-local to deliver message by defaultexec env - path = "/ var / qmail / bin: $ PATH" / qmail -start "CAT / VAR / QMAIL / Control / DefaultDelivery" CHMOD 755 / VAR / QMAIL / RCMKDIR / VAR / LOG / QMAIL
Echo ./mailbox> / var / qmail / control / defaultdelivery
Generate file / var / qmail / bin / qmailctl #! / Bin / sh
# Description: The qmail mta
Path = / var / qmail / bin: / bin: / usr / bin: / usr / local / bin: / usr / local / sbinexport path
Qmailduid = `ID - qmails`nofilesgid =` ID -G qmail`
Case "$ 1" instart) echo "starting qmail" if svok / service / qmail-send; THENSVC -U / service / qmail-send / service / qmail-send / Logelseecho "qmail-send supervise not running" FIIF SVOK / Service / qmail-smtpd; thensvc -u / service / qmail-smtpd / service / qmail-smtpd / logelseecho "qmail-smtpd supervise not running" fiif svok / service / qmail-pop3d; thensvc -u / service / qmail-pop3d / service / Qmail-pop3d / logelseecho qmail-pop3d supervise not runningfiif [-d / var / lock / subsys]; life / var / limited / subsys / qmailfi ;; stop) echo "stopping qmail ..." echo "qmail-smtpd" SVC -d / service / qmail-smtpd / service / qmail-smtpd / LOGECHO "qmail-send" svc -d / service / qmail-send / service / qmail-send / LOGECHO "qmail-pop3d" svc -d / service / qmail -POP3D / Service / qmail-pop3d / logif [-f / var / lock / subsys / qmail]; thenrm / var / lock / subsys / qmailfi ;; stat) svstat / service / qmail-sendsvstat / service / qmail-send / Logsvstat / service / qmail-smtpdsvstat / service / qmail-smtpd / logsvstat / service / qmail-pop3dsvstat / service / qmail-pop3d / logqmail-qstat ;; DOQUEUE | ALRM | FLUSH) Echo "Flushing Timeout Table and sending Alrm Signal to qmail-send." / var / qmail / bin / qmail-tcpoksvc -a / service / qmail-send ;; queue) qmail-qstatqmail-qRead ;; reload | HUP) Echo "Sending Hup Signal to Qmail-send." SVC -H / Service / Qmail-send ;; Pause) Echo "PAUSING QMAIL-Send" SVC -P / Service / qmail-sendecho "PAUSING QMAIL-SMTPD" SVC - P / service / qmail-smtpdecho "PAUSING QMAIL-POP3D" SVC -P / Service / Qmail-Pop3d ;; Cont) Echo "Continuing qmail-send" SVC -C / Service / qmail-sendecho "Continuing qmail-smtpd" SVC - SVC C / service / qmail-smtpdecho "Continuing qmail-pop3d" svc -c / service / qmail-pop3d ;; rest) echo "Restarting QMAIL:"
Echo "* stopping qmail-smtpd." SVC -D / service / qmail-smtpd / service / qmail-smtpd / LOGECHO "* sending qmail-send sigterm and restarting." SVC -T / Service / qmail-send / service / qmail -send / lockcho "* restarting qmail-smtpd." SVC -U / service / qmail-smtpd / service / qmail-smtpd / LOGECHO "* Restarting qmail-pop3d." SVC -T / Service / qmail-pop3d / service / qmail -POP3D / LOG ;; CDB) TCPRules /etc/qmail/tcp.smtp.cdb /etc/qmail/tcp.smtp.tmp
Mkdir -P / var / qmail / supervise / qmail-send / logmkdir -p / var / qmail / supervise / qmail-smtpd / log
Generate / var / qmail / supervise / qmail-send / run #! / Bin / shexec / var / qmail / rc
Generate / var / qmail / supervise / qmail-send / log / run #! / Bin / shexec / usr / local / bin / setuidgid qmaill / usr / local / bin / multililog t / var / log / qmail
Generate / VAR / QMAIL / Supervise / qmail-smtpd / run #! / Bin / shqmailduid = `ID --U vpopmail`nofilesgid =` ID -G vpopmail`maxsmtpd = `cat / var / qmail / control / concurrencyincoming`local =` Head -1 / var / qmail / control / me`
IF [-z "$ nofilesgid" -o -z "$ maxsmtpd" -o -z "$ local"]; Thenecho qmails, nofilesgid, maxsmtpd, or local is unset inecho / var / qmail / supervise / qmail-smtpd / runexit 1fi
IF [! -f / var / qmail / control / rcpthosts]; thenecho "no / var / qmail / control / rcpthosts!" echo "refusing to start smtp listener because it'll create an open radi" exit 1fi
Exec / usr / local / bin / softlimit -m 5000000 // usr / local / bin / tcpserver -v -r -l "$ local" -X /etc/qmail/tcp.smtp.cdb -c "$ maxsmtpd" / -u "$ qmailduid" -g "$ nofilesgid" 0 SMTP / VAR / QMAIL / BIN / QMAIL-SMTPD 2> & 1
Generation / VAR / QMAIL / SuperVise / qmail-smtpd / log / run #! / Bin / shexec / usr / local / bin / setuidgid qmaill / usr / local / bin / multiliLog T / var / log / qmail / smtpd
Generate / VAR / QMAIL / SuperVise / qmail-pop3d / run
#! / bin / sh
Qmailduid = `ID -U vpopmail`nofilesgid =` ID -G vpopmail`local = `head -1 / var / qmail / control / me`
IF [-z "$ qmails" -o -z "$ local"]; thenecho qmails, nofilesgid, or local is unset inecho / var / qmail / supervise / qmail-pop3d / runexit 1fi
Exec / usr / local / bin / softlimit -m 5000000 // usr / local / bin / tcpserver -r -h -x /etc/qmail/tcp.pop3.cdb / -u "$ qLDUID" -g "$ nofilesgid" 0 110 / VAR / QMAIL / BIN / QMAIL-POPUP / "$ local" / server / vpopmail / bin / vchkpw / var / qmail / bin / qmail-pop3d maildir 2> & 1
Generate / var / qmail / supervise / qmail-pop3d / log / run #! / Bin / shexec / usr / local / bin / setuidgid qmaill / usr / local / bin / multilog t // var / log / qmail / pop3decho 20> / VAR / QMAIL / Control / ConcurrencyIncomingchmod 644 / VAR / QMAIL / Control / ConcurrencyInComing
CHMOD 755 / VAR / QMAIL / SuperVise / qmail-send / RunchMod 755 / VAR / QMAIL / SuperVise / qmail-send / log / runchmod 755 / var / qmail / supervise / qmail-smtpd / runchmod 755 / var / qmail / supervise / qmail-smtpd / log / run
MKDIR -P / VAR / LOG / QMAIL / SMTPDCHOWN QMAILL / VAR / LOG / qmail / var / log / qmail / smtpdmkdir -p / var / log / qmail / pop3dchown qmaill / var / log / qmail / var / log / qmail / POP3D
MKDIR / ETC / QMAILECHO '127.:Allow ,ylayclient= "" ">> / etc / qmail / tcp.smtpecho': allow '>> / etc / qmail / tcp.pop3qmailctl CDB
VPOPMAILGROUPADD -G 89 vchkpwuseradd -g vchkpw -u 89 vpopmail
With / server / mysql / bin / mysql log into mysql, build vpopmail database CREATE DATABASE vpopmail;. GRANT select, insert, update, delete, create, drop ON vpopmail * TO vpopmailuser @ localhost IDENTIFIED BY 'vpoppasswd';
./configure / - prefix = / server / vpopmail / - enable-qmails = / var / qmail / - enable-vpopuser = vpopmail / - enable-vpopGroup = vchkpw / - enable-roaming-users / Enable-tcprules-prog = / usr / local / bin / tcprules /-enable-tcpserver-file=/etc/qmail/tcp.smtp / - enable-recomlay-clear-limited = 20 / - enable-auth- Logging / - enable-mysql-logging / - enable-clear-passwd / - disable-sqwebmail-pass / - enable-log-name = vpopmail / - enable-incdir = / server / mysql / include / mysql / - enable-libdir = / server / mysql / lib / mysql / - enable-libs = mysqlclient / - enable-auth-module = mysql / - enable-ip-alias-domains / - enable-mysql- LIMITS / - ENABLE-MANY-DOMAINS / - DISABLE-Passwd / - Enable-mysql-Limits
Makemake Install-Strip
echo "localhost | 0 | vpopmailuser | vpoppasswd | vpopmail"> /server/vpopmail/etc/vpopmail.mysqlchown vpopmail.vchkpw /server/vpopmail/etc/vpopmail.mysqlchmod 640 ~ vpopmail / etc / vpopmail.mysqlecho 'mydomain.com' > / var / qmail / control / rcpthosts / var / qmail / bin / vaddomain mydomain.com
Qmailadmin./configure --Nable-cgibindir = / server / apache2 / cgi-bin / - enable-htmldir = / server / apache2 / htdocsmakemake install
Sqwebmail./configure / - prefix = / server / sqwebmail / - with-cachedir = / server / sqwebmail / cachetmp / - enable-imagedir = / server / Apache2 / htdocs / webmail / - enable-cgibindir = / server / apache2 / cgi-bin / - enable-softtimeout = 1200 / - enable-hardtimeout = 1800 / - with-fcgimakemake install
LN -S / VAR / QMAIL / SuperVise / qmail-send / var / qmail / supervise / qmail-smtpd / var / qmail / supervise / qmail-pop3d / service
Start Apache, you can log in to manage mydomain.com with postmaster@mydomain.com with postmaster@mydomain.com from qmailadmin. After adding an Email address Test@mydomain.com, you can use Outlook and Test@mydomain.com users to send and receive email.
Other Installation Articles: "Detailed Detailed Webmail Solution Based on Qmail" http://www.phpx.com/index.php?itemid=130
6, SMTPD user authentication function download http://www.garhee.com/download/qmail-smtpd.c; this is changed from NetQmail-1.05 version, if you want to change your version, please change
/ VAR / QMAIL / BIN / QMAILCTL STOP Change / VAR / QMAIL / SuperVise / qmail-smtpd / run in EXEC / USR / LOCAL / BIN / SOFTLIMIT -M 5000000 / / USR / local / bin / tcpserver -v -r - l "$ local" -x /etc/qmail/tcp.smtp.cdb -c "$ maxsmtpd" / -u "$ qLDUID" -g "$ nofilesgid" 0 SMTP / VAR / QMAIL / BIN / QMAIL-SMTPD 2> & 1 is EXEC / USR / local / bin / softlimit -m 5000000 // usr / local / bin / tcpserver -v -h -r -l "$ local" -x /etc/qmail/tcp.smtp.cdb -c " $ MAXSMTPD "/ -U" $ qLDUID "-g" $ nofilesgid "0 SMTP / VAR / QMAIL / BIN / qmail-smtpd // server / vpopmail / bin / vchkpw / bin / true 2> & 1 / var / qmail / bin / qmailctl start7, install pureftpd to http://mirrors.sunsite.dk/pure-ftpd/ download (Pureftp.org is sealed) http://Home.9812.net/linux/Article/pureftPD/ Download installation configuration Document ./configure --prefix = / server / pureftp / - with-boring / - with-whrottling / - with-ratios / - VirtualHosts / - With-VirtualchRoot / - with-peruserlimits / -with-mysql = / server / mysql / - with-ftpwho / - with-language = Simplified-Chinese / - WITHOUT-INETD / - WITHOUT-shadow / - diraliases / - with-sysquotas / --with-altlog / - with-quotas / - with-prote Ivsepmakemake install
CP pureftpd-mysql.conf / server / pureftp / etc / cp configuration-file / pure-ftpd.conf / server / pureftp / etc / modify two configure files until satisfaction
CP Configuration-File / Pure-config.pl / Server / Pureftp / Bin / Added / Server / PureftP / Sbin / Pure-ftpd to: -x && ($ PureftPD = $ _, Last) for QW ($ / Sbin / Pure-ftpd / usr / local / pure-ftpd / sbin / pure-ftpd / usr / local / pureft / sbin / pure-ftpd / usr / usr / sbin / pure-ftpd / usr / sbin / pure-ftpd / server / Pureftp / sbin / pure-ftpd);
UserAdd ftp -u 1111 -g proFTpGroup -s / bin / false -d / bin / null -c "pureftpd user"
Log execute mysql sql statement:. Create database pureftp; GRANT ALL ON pureftp * TO pureftp @ localhost IDENTIFIED BY 'purepasswd'; CREATE TABLE `users` (` id` int (32) unsigned NOT NULL auto_increment, `User` varchar (16 NOT NULL Default ', `password` VARCHAR (64) Not null default',` uid` VARCHAR (11) Not null default '-1', `gid` VARCHAR (11) Not null default '-1', `Dir`, 128) Not Null Default ',` Quotasize` Smallint (5) Not null default' 0 ', `quotafiles` int (11) Not null default' 0 ',` UlbandWidth` Smallint (5) Not null Default '0', `DlbandWidth` Smallint (5) Not null default '0',` ulratio` smallint (6) Not null default '0', `Dlratio` Smallint (6) Not null default '0',` Comment` Tinytext not null, `iPaccess` VARCHAR (15) Not null default '*',` status`, ('0', '1') Not null default '0', `Create_Date` DateTime Not Null Default '0000-00-00-00-00-00-00-00-00 00 00:00: 00 ' ) Type = myisam auto_increment = 5; INSERT INTO USERS VALUES (5, ' TEST ', MD5 (' Test '),' 505 ',' 505 ',' / TMP ', 0, 0, 0, 0, 0, 0,' ',' * ',' 1 ',' 2003-06 -26 18:04:33 ',' 2003-06-26 18:04:33 '); Start PureftPD / Server / PureftP / Bin / Pure-config.pl / Server/pureftp/pure-ftpd.conf Stop Pureftpdkill -int `cat /var/run/pure-ftpd.pid | sed 1q`