CentOS 5安装ISPConfig 3主机控制面板详细教程

有运维或运维开发方面的需求,可以联系博主QQ 452336092或Email:admin#centos.bz(收费)

文章目录
[隐藏]

ISPConfig 3是Linux的一个开源主机控制面板。ISPConfig 3能够通过一个控制面板管理多台服务器。

服务与功能

  • 单个控制面板管理一台或更多的服务器(多服务器管理)
  • 不同的权限极别(管理员,代理商,客户)+roudcube插件为ISPConfig提供的电子邮件用户极别
  • Httpd(虚拟主机,基于域名和IP)
  • FTP,SFTP,SCP
  • DNS(A, CNAME, MX, SRV和TXT记录 )
  • POP3,IMAP
  • Email-Autoresponder
  • 服务器邮件过滤
  • 高级的email spamfilter和antivirus filter邮件过滤软件
  • MySQL client-databases
  • Webalizer statistics
  • 硬盘配额
  • 邮件配额
  • 流量限制和统计
  • 多IP支持
  • SSL
  • SSI
  • PHP (可用的PHP模块: mod_php, FCGI,CGI和SuPHP)
  • Shell-access
  • Jailed shell access
  • 防火墙
  • 服务器监控模块
  • phpmyadmin MySQL数据库客户端

现在我们开始安装ISPConfig 3。
在安装之前,我们需要禁用Iptables和SELinux
system-config-securitylevel

如果提示命令不存在,则表示没有安装system-config-securitylevel,执行yum install system-config-securitylevel命令安装即可。

安装一些软件

  1. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
  2. yum update
  3. yum groupinstall 'Development Tools'
  4. yum groupinstall 'Development Libraries'

安装Quota

  1. yum install quota

编辑/etc/fstab,添加,usrquota,grpquota 到/ partition(/dev/VolGroup00/LogVo100)后面,添加后如下:

  1. /dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota,grpquota        1 1
  2. LABEL=/boot             /boot                   ext3    defaults        1 2
  3. tmpfs                   /dev/shm                tmpfs   defaults        0 0
  4. devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
  5. sysfs                   /sys                    sysfs   defaults        0 0
  6. proc                    /proc                   proc    defaults        0 0
  7. /dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

然后运行如下命令启用quota

  1. touch /aquota.user /aquota.group
  2. chmod 600 /aquota.*
  3. mount -o remount /
  4. quotacheck -avugm
  5. quotaon -avug

注意:这种设置可能不适合VPS。

安装Apache, MySQL, phpMyAdmin

  1. rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
  2. cd /tmp
  3. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
  4. rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
  5. yum install ntp httpd mysql-server php php-mysql php-mbstring php-mcrypt phpmyadmin rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel

安装Courier-IMAP, Courier-Authlib和Maildrop

  1. useradd -m -s /bin/bash compileuser
  2. passwd compileuser
  3. visudo

按如下编辑

  1. [...]
  2. root    ALL=(ALL)       ALL
  3. compileuser   ALL=(ALL)       ALL
  4. [...]
  1. su compileuser
  2. mkdir $HOME/rpm
  3. mkdir $HOME/rpm/SOURCES
  4. mkdir $HOME/rpm/SPECS
  5. mkdir $HOME/rpm/BUILD
  6. mkdir $HOME/rpm/SRPMS
  7. mkdir $HOME/rpm/RPMS
  8. mkdir $HOME/rpm/RPMS/i386
  9. echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros
  10. cd /tmp
  11. wget http://nchc.dl.sourceforge.net/project/courier/authlib/0.63.0/courier-authlib-0.63.0.tar.bz2
  12. wget http://nchc.dl.sourceforge.net/project/courier/imap/4.9.3/courier-imap-4.9.3.tar.bz2
  13. wget http://nchc.dl.sourceforge.net/project/courier/maildrop/2.5.4/maildrop-2.5.4.tar.bz2
  14. sudo rpmbuild -ta courier-authlib-0.63.0.tar.bz2
  15. cd $HOME/rpm/RPMS/i386
  16. sudo rpm -ivh courier-authlib-0.63.0-1.i386.rpm courier-authlib-mysql-0.63.0-1.i386.rpm courier-authlib-devel-0.63.0-1.i386.rpm
  17. cd /tmp
  18. rpmbuild -ta courier-imap-4.9.3.tar.bz2
  19. cd $HOME/rpm/RPMS/i386
  20. sudo rpm -ivh courier-imap-4.9.3-1.i386.rpm
  21. cd /tmp
  22. sudo rpmbuild -ta maildrop-2.5.4.tar.bz2
  23. cd $HOME/rpm/RPMS/i386
  24. sudo rpm -ivh maildrop-2.5.4-1.i386.rpm
  25. exit

安装Postfix

  1. yum install postfix
  2. chkconfig --levels 235 courier-authlib on
  3. /etc/init.d/courier-authlib start
  4. chkconfig --levels 235 sendmail off
  5. chkconfig --levels 235 postfix on
  6. chkconfig --levels 235 saslauthd on
  7. /etc/init.d/sendmail stop
  8. /etc/init.d/postfix start
  9. /etc/init.d/saslauthd restart

配置Courier

  1. chkconfig --levels 235 courier-imap on
  2. /etc/init.d/courier-authlib restart
  3. /etc/init.d/courier-imap restart
  4. cd /usr/lib/courier-imap/share/
  5. rm -f imapd.pem
  6. rm -f pop3d.pem
  7. vi /usr/lib/courier-imap/etc/imapd.cnf

最后编辑结果如下:

  1. [...]
  2. CN=server1.example.com
  3. [...]
  1. vi /usr/lib/courier-imap/etc/pop3d.cnf

最后编辑结果如下:

  1. [...]
  2. CN=server1.example.com
  3. [...]
  1. ./mkimapdcert
  2. ./mkpop3dcert
  3. /etc/init.d/courier-authlib restart
  4. /etc/init.d/courier-imap restart

安装getmail

  1. yum install getmail

设置MySQL密码和配置phpMyAdmin

  1. chkconfig --levels 235 mysqld on
  2. /etc/init.d/mysqld start
  3. mysqladmin -u root password yourrootsqlpassword
  4. mysqladmin -h server1.example.com -u root password yourrootsqlpassword
  5. vi /etc/httpd/conf.d/phpmyadmin.conf

修改结果如下:

  1. #
  2. #  Web application to manage MySQL
  3. #
  4.  
  5. #<Directory "/usr/share/phpmyadmin">
  6. #  Order Deny,Allow
  7. #  Deny from all
  8. #  Allow from 127.0.0.1
  9. #</Directory>
  10.  
  11. Alias /phpmyadmin /usr/share/phpmyadmin
  12. Alias /phpMyAdmin /usr/share/phpmyadmin
  13. Alias /mysqladmin /usr/share/phpmyadmin
  1. vi /usr/share/phpmyadmin/config.inc.php

修改结果如下:

  1. [...]
  2. /* Authentication type */
  3. $cfg['Servers'][$i]['auth_type'] = 'http';
  4. [...]
  1. chkconfig --levels 235 httpd on
  2. /etc/init.d/httpd start

安装Amavisd-new, SpamAssassin和ClamAV

  1. yum install amavisd-new spamassassin clamav clamd unzip bzip2 unrar perl-DBD-mysql
  2. chkconfig --levels 235 amavisd on
  3. chkconfig --levels 235 clamd on
  4. /usr/bin/freshclam
  5. /etc/init.d/amavisd start
  6. /etc/init.d/clamd start
  7. mkdir /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
  8. chown amavis /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db

安装Apache的组件mod_php, mod_fcgi/PHP5和suPHP

  1. cd /etc/yum.repos.d/
  2. wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
  3. vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo

把enabled=0改为enabled=1。如下:

  1. [...]
  2. [kbs-CentOS-Testing]
  3. name=CentOS.Karan.Org-EL$releasever - Testing
  4. gpgcheck=0
  5. gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
  6. enabled=1
  7. baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/
  1. yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-mbstring php-mcrypt php-mhash php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli httpd-devel
  1. vi /etc/php.ini

编辑结果如下:

  1. [...]
  2. ;error_reporting  =  E_ALL
  3. error_reporting = E_ALL & ~E_NOTICE
  4. [...]
  5. cgi.fix_pathinfo = 1
  1. cd /tmp
  2. wget http://www.suphp.org/download/suphp-0.7.1.tar.gz
  3. tar xvfz suphp-0.7.1.tar.gz
  4. cd suphp-0.7.1/
  5. ./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=owner --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes
  6. make && make install
  7. vi /etc/httpd/conf.d/suphp.conf

加入如下行:

  1. LoadModule suphp_module modules/mod_suphp.so
  1. vi /etc/suphp.conf

加入如下代码:

  1. [global]
  2. ;Path to logfile
  3. logfile=/var/log/httpd/suphp.log
  4.  
  5. ;Loglevel
  6. loglevel=info
  7.  
  8. ;User Apache is running as
  9. webserver_user=apache
  10.  
  11. ;Path all scripts have to be in
  12. docroot=/
  13.  
  14. ;Path to chroot() to before executing script
  15. ;chroot=/mychroot
  16.  
  17. ; Security options
  18. allow_file_group_writeable=true
  19. allow_file_others_writeable=false
  20. allow_directory_group_writeable=true
  21. allow_directory_others_writeable=false
  22.  
  23. ;Check wheter script is within DOCUMENT_ROOT
  24. check_vhost_docroot=true
  25.  
  26. ;Send minor error messages to browser
  27. errors_to_browser=false
  28.  
  29. ;PATH environment variable
  30. env_path=/bin:/usr/bin
  31.  
  32. ;Umask to set, specify in octal notation
  33. umask=0077
  34.  
  35. ; Minimum UID
  36. min_uid=100
  37.  
  38. ; Minimum GID
  39. min_gid=100
  40.  
  41. [handlers]
  42. ;Handler for php-scripts
  43. x-httpd-suphp="php:/usr/bin/php-cgi"
  44.  
  45. ;Handler for CGI-scripts
  46. x-suphp-cgi="execute:!self"
  1. /etc/init.d/httpd restart

编译安装Pure-FTPd

  1. cd /tmp
  2. wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.32.tar.gz
  3. tar zxvf pure-ftpd-1.0.32.tar.gz
  4. cd pure-ftpd-1.0.32/
  5. ./configure --prefix=/opt/pureftpd \
  6.        --with-mysql= \
  7.                     --with-paranoidmsg \
  8.                     --with-shadow \
  9.                     --with-welcomemsg \
  10.                     --with-uploadscript \
  11.                     --with-quotas \
  12.                     --with-cookie \
  13.                     --with-virtualhosts \
  14.                     --with-diraliases \
  15.                     --with-sysquotas \
  16.                     --with-ratios \
  17.                     --with-ftpwho \
  18.                     --with-throttling \
  19.                     --with-altlog \
  20.                     --with-language=simplified-chinese
  21. make && make install
  22. mkdir /etc/pure-ftpd
  23. cp pureftpd-mysql.conf /etc/pure-ftpd
  24. cp configuration-file/pure-ftpd.conf /etc/pure-ftpd
  25. cp configuration-file/pure-config.pl /etc
  26. vi /etc/init.d/pure-ftpd

加入如下代码:

  1. #!/bin/bash
  2. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
  3. export PATH
  4. # Check if user is root
  5. if [ $(id -u) != "0" ]; then
  6.     printf "Error: You must be root to run this script!\n"
  7.     exit 1
  8. fi
  9. prog="Pure-FTPd"
  10. PUREPIDFILE="/var/run/pure-ftpd.pid"
  11. PURECONFIGPL="/etc/pure-config.pl"
  12. PURECONFIGFILE="/etc/pure-ftpd/pure-ftpd.conf"
  13. start() {
  14. printf "Starting $prog... \n"
  15. $PURECONFIGPL $PURECONFIGFILE --daemonize
  16. }
  17. stop() {
  18. printf "Stopping $prog... \n"
  19. kill `cat $PUREPIDFILE`
  20. }
  21. status() {
  22. if [ -e $PUREPIDFILE ]; then
  23. printf "$prog is running.\n"
  24. else
  25. printf "$prog is NOT running.\n"
  26. fi
  27. }
  28. case "$1" in
  29.  
  30. start)
  31. start
  32. ;;
  33. stop)
  34. stop
  35. ;;
  36. restart)
  37. stop
  38. start
  39. ;;
  40.  
  41. status)
  42. status
  43. ;;
  44. *)
  45. printf "Usage: /root/pureftpd {start|stop|restart|status}\n"
  46.  
  47. esac
  48.  
  49. exit
  1. chmod 755 /etc/pure-config.pl
  2. ln -s /opt/pureftpd/sbin/pure-ftpd /usr/sbin/
  3. chmod 755 /etc/init.d/pure-ftpd
  4. chkconfig --levels 235 pure-ftpd on
  5. /etc/init.d/pure-ftpd start

安装MyDNS

  1. cd /tmp
  2. wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
  3. rpm -ivh mydns-mysql-1.1.0-1.i386.rpm
  4. vi /etc/init.d/mydns

编辑如下:

  1. [...]
  2. #chkconfig: 345 65 50
  3. [...]
  1. chkconfig --levels 235 mydns on

安装Vlogger And Webalizer

  1. yum install webalizer perl-DateTime-Format-HTTP perl-DateTime-Format-Builder
  2. wget http://n0rp.chemlab.org/vlogger/vlogger-1.3.tar.gz
  3. tar xvfz vlogger-1.3.tar.gz
  4. mv vlogger-1.3/vlogger /usr/sbin/
  5. rm -rf vlogger*

安装Jailkit

  1. cd /tmp
  2. wget http://olivier.sessink.nl/jailkit/jailkit-2.14.tar.gz
  3. tar xvfz jailkit-2.14.tar.gz
  4. cd jailkit-2.14
  5. ./configure
  6. make && make install

安装fail2ban

  1. yum install fail2ban
  2. chkconfig --levels 235 fail2ban on
  3. /etc/init.d/fail2ban start

安装rkhunter

  1. yum install rkhunter

安装SquirrelMail

  1. yum install squirrelmail
  2. /etc/init.d/httpd restart
  3. /usr/share/squirrelmail/config/conf.pl

按如下提示操作:
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. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >> <-- 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 server

quit = Do not change anything
Command >> <-- courier

imap_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 = true

Press 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. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >> <--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. Languages

D. Set pre-defined settings for specific IMAP servers

C Turn color off
S Save data
Q Quit

Command >> <--Q

  1. vi /etc/squirrelmail/config_local.php

注释最后一行,如下:

  1. <?php
  2. /**
  3.  * Local config overrides.
  4.  *
  5.  * You can override the config.php settings here.
  6.  * Don't do it unless you know what you're doing.
  7.  * Use standard PHP syntax, see config.php for examples.
  8.  *
  9.  * @copyright &copy; 2002-2006 The SquirrelMail Project Team
  10.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  11.  * @version $Id: config_local.php,v 1.2 2006/07/11 03:33:47 wtogami Exp $
  12.  * @package squirrelmail
  13.  * @subpackage config
  14.  */
  15. //$default_folder_prefix                = '';
  16. ?>

安装ISPConfig 3

  1. cd /tmp
  2. wget http://downloads.sourceforge.net/project/ispconfig/ISPConfig%203/ISPConfig-3.0.3.3/ISPConfig-3.0.3.3.tar.gz?r=&ts=1309567938&use_mirror=nchc
  3. tar xvfz ISPConfig-3.0.3.3.tar.gz
  4. cd ispconfig3_install/install/
  5. php -q install.php

按如下提示操作:
——————————————————————————–
_____ ___________ _____ __ _
|_ _/ ___| ___ \ / __ \ / _(_)
| | \ `–.| |_/ / | / \/ ___ _ __ | |_ _ __ _
| | `–. \ __/ | | / _ \| ‘_ \| _| |/ _` |
_| |_/\__/ / | | \__/\ (_) | | | | | | | (_| |
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, |
__/ |
|___/
——————————————————————————–

>> Initial configuration

Operating System: CentOS 5.2 or compatible

Following will be a few questions for primary configuration so be careful.
Default values are in [brackets] and can be accepted with .
Tap in “quit” (without the quotes) to stop the installer.

Select language (en,de) [en]:

Installation mode (standard,expert) [standard]: <-- ENTER

Full qualified hostname (FQDN) of the server, eg server1.domain.tld [server1.example.com]: <-- 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 coolcode) [GB]: <-- ENTER
State or Province Name (full name) [Berkshire]: <-- ENTER
Locality Name (eg, city) [Newbury]: <-- ENTER
Organization Name (eg, company) [My Company Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (eg, your name or your server’s hostname) []: <-- 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]: <-- ENTER

Configuring DBServer
Installing Crontab
no crontab for root
no crontab for getmail
Restarting services …
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
Stopping saslauthd: [ OK ]
Starting saslauthd: [ OK ]
Shutting down Mail Virus Scanner (amavisd): [ OK ]
Starting Mail Virus Scanner (amavisd): [ OK ]
Stopping Clam AntiVirus Daemon: [ OK ]
Starting Clam AntiVirus Daemon: [ OK ]
Stopping Courier authentication services: authdaemond
Starting Courier authentication services: authdaemond
Stopping Courier-IMAP server: imap imap-ssl pop3 pop3-ssl
Starting Courier-IMAP server: imap imap-ssl pop3 pop3-ssl
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
Stopping pure-ftpd: [ OK ]
Starting pure-ftpd: [ OK ]
Installation completed.
之后,你就可以通过http://server1.example.com:8080/ or http://192.168.0.100:8080/,用户名和密码都admin来登录后台了。
后台登录界面:

Administartor后台界面:

Reseller后台界面:

Client后台界面:

ISPConfig后台演示地址:http://www.ispconfig.org/ispconfig-3/online-demo/
官方网站:http://www.ispconfig.org/
参考文章:http://www.howtoforge.com/perfect-server-centos-5.2-ispconfig-3

转载请保留原文链接:Linux运维日志 » CentOS 5安装ISPConfig 3主机控制面板详细教程

打赏

如果此文对你有所帮助,请随意打赏鼓励作者^_^

相关推荐

    暂无内容!