|
| 1 | +Installation |
| 2 | +----------- |
| 3 | + |
| 4 | +# It is recommended to use a clean (fresh) Debian Squeeze install where you just selected "Standard System" as the package selection during |
| 5 | +# setup. Then follow the steps below to setup your server with ISPConfig 3. In this guide "vi" is used as texteditor, but you ofcourse |
| 6 | +# you can use whatever you prefer. You should be root for doing all of this. |
| 7 | + |
| 8 | + |
| 9 | +# Check we have Fully Qualified Domain Name |
| 10 | + |
| 11 | +/bin/hostname |
| 12 | + |
| 13 | +# it should return something like "ispconfig.example.com" |
| 14 | +# if not, then we assign a hostname (for example ispconfig): |
| 15 | + |
| 16 | +echo ispconfig.example.com > /etc/hostname |
| 17 | + |
| 18 | +vi /etc/hosts |
| 19 | + |
| 20 | +# and add lines similar but appropriate: |
| 21 | + |
| 22 | +127.0.0.1 localhost.localdomain localhost |
| 23 | +192.168.0.100 ispconfig.example.com ispconfig |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +# Some optional choices |
| 28 | + |
| 29 | +opt0.1) Optionally install SSH-server to get remote shell |
| 30 | + |
| 31 | +apt-get install ssh openssh-server |
| 32 | + |
| 33 | +opt0.2) Optionally if you are not running in virtual machine you can set server clocksync via NTP. Virtual quests get this from the host. |
| 34 | + |
| 35 | +apt-get install ntp ntpdate |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +# Next is the real deal |
| 40 | + |
| 41 | +1) Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter, binutils with the following command line (on one line!): |
| 42 | + |
| 43 | +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 |
| 44 | + |
| 45 | +# Answer the questions from the package manager as follows. |
| 46 | + |
| 47 | +Create directories for web-based administration ? <-- No |
| 48 | +General type of configuration? <-- Internet site |
| 49 | +Mail name? <-- server1.mydomain.tld |
| 50 | + SSL certificate required <-- Ok |
| 51 | + |
| 52 | +# ...use your own domain name of course ;) |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +# Edit the file /etc/mysql/my.cnf |
| 57 | + |
| 58 | +vi /etc/mysql/my.cnf |
| 59 | + |
| 60 | +# and change the line: |
| 61 | + |
| 62 | +bind-address = 127.0.0.1 |
| 63 | + |
| 64 | +to: |
| 65 | + |
| 66 | +#bind-address = 127.0.0.1 |
| 67 | + |
| 68 | +# then restart mysql |
| 69 | + |
| 70 | +/etc/init.d/mysql restart |
| 71 | + |
| 72 | +2) Install Amavisd-new, Spamassassin and Clamav (1 line!): |
| 73 | + |
| 74 | +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 |
| 75 | + |
| 76 | +# During the installation, the SSL certificates for IMAP-SSL and POP3-SSL are created with the hostname localhost. To change this to the correct hostname (server1.example.com in this tutorial), delete the certificates... |
| 77 | + |
| 78 | +cd /etc/courier |
| 79 | +rm -f /etc/courier/imapd.pem |
| 80 | +rm -f /etc/courier/pop3d.pem |
| 81 | + |
| 82 | +# ... and modify the following two files; replace CN=localhost with CN=server1.example.com (you can also modify the other values, if necessary): |
| 83 | + |
| 84 | +vi /etc/courier/imapd.cnf |
| 85 | + |
| 86 | +[...] |
| 87 | +CN=server1.example.com |
| 88 | +[...] |
| 89 | + |
| 90 | +vi /etc/courier/pop3d.cnf |
| 91 | + |
| 92 | +[...] |
| 93 | +CN=server1.example.com |
| 94 | +[...] |
| 95 | + |
| 96 | +# Then recreate the certificates... |
| 97 | + |
| 98 | +mkimapdcert |
| 99 | +mkpop3dcert |
| 100 | + |
| 101 | +# ... and restart Courier-IMAP-SSL and Courier-POP3-SSL: |
| 102 | + |
| 103 | +/etc/init.d/courier-imap-ssl restart |
| 104 | +/etc/init.d/courier-pop-ssl restart |
| 105 | + |
| 106 | + |
| 107 | +3) Install apache, PHP5, phpmyadmin, better fastCGI, suexec, Pear and mcrypt (1 line!): |
| 108 | + |
| 109 | +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 libopenssl-ruby |
| 110 | + |
| 111 | + |
| 112 | +# When phpMyAdmin is asking weather to configure itself automatically, select "Apache2" |
| 113 | + |
| 114 | +# Then run the following to enable the Apache modules suexec, rewrite and ssl: |
| 115 | + |
| 116 | +a2enmod suexec rewrite ssl actions include |
| 117 | + |
| 118 | +# restart apache before continuing |
| 119 | + |
| 120 | +/etc/init.d/apache2 restart |
| 121 | + |
| 122 | + |
| 123 | +4) Install pure-ftpd and quota |
| 124 | + |
| 125 | +apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool |
| 126 | + |
| 127 | +# Edit the file /etc/default/pure-ftpd-common to change the start mode from "inetd" to "standalone" |
| 128 | +and set VIRTUALCHROOT=true |
| 129 | + |
| 130 | +vi /etc/default/pure-ftpd-common |
| 131 | + |
| 132 | +# Edit the file /etc/inetd.conf to prevent inetd from trying to start ftp. |
| 133 | +# To do this, comment line starting like "ftp stream tcp" by adding "#"-sign in front of the line. |
| 134 | + |
| 135 | +vi /etc/inetd.conf |
| 136 | + |
| 137 | +# Then execute: |
| 138 | + |
| 139 | +/etc/init.d/openbsd-inetd restart |
| 140 | + |
| 141 | +# Some additional settings for pureftpd |
| 142 | + |
| 143 | +echo 'yes' > /etc/pure-ftpd/conf/DontResolve |
| 144 | + |
| 145 | +# Enable TLS in pureftpd |
| 146 | +echo 1 > /etc/pure-ftpd/conf/TLS |
| 147 | +mkdir -p /etc/ssl/private/ |
| 148 | +openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem |
| 149 | +chmod 600 /etc/ssl/private/pure-ftpd.pem |
| 150 | + |
| 151 | + |
| 152 | +# Edit /etc/fstab. Mine looks like this (I added ,usrquota,grpquota to the partition with the mount point /): |
| 153 | + |
| 154 | +vi /etc/fstab |
| 155 | + |
| 156 | +---------------------------------------------------------------------------------------------- |
| 157 | +# /etc/fstab: static file system information. |
| 158 | +# |
| 159 | +# <file system> <mount point> <type> <options> <dump> <pass> |
| 160 | +proc /proc proc defaults 0 0 |
| 161 | +/dev/sda1 / ext4 errors=remount-ro,usrquota,grpquota 0 1 |
| 162 | +/dev/sda5 none swap sw 0 0 |
| 163 | +/dev/hda /media/cdrom0 udf,iso9660 user,noauto 0 0 |
| 164 | +/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0 |
| 165 | +---------------------------------------------------------------------------------------------- |
| 166 | + |
| 167 | +# To enable quota, run these commands: |
| 168 | + |
| 169 | +touch /quota.user /quota.group |
| 170 | +chmod 600 /quota.* |
| 171 | +mount -o remount / |
| 172 | +quotacheck -avugm |
| 173 | +quotaon -avug |
| 174 | + |
| 175 | + |
| 176 | +5) Install mydns |
| 177 | + |
| 178 | +apt-get install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev |
| 179 | + |
| 180 | +cd /tmp |
| 181 | +wget http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.27.tar.gz |
| 182 | +tar xvfz mydns-1.2.8.27.tar.gz |
| 183 | +cd mydns-1.2.8 |
| 184 | +./configure |
| 185 | +make |
| 186 | +make install |
| 187 | + |
| 188 | +# Now create the start / stop script for mydns: |
| 189 | + |
| 190 | +vi /etc/init.d/mydns |
| 191 | + |
| 192 | +# and enter the following lines (between the ----- lines): |
| 193 | + |
| 194 | +------------------------------------------------------ |
| 195 | +#! /bin/sh |
| 196 | +# |
| 197 | +# mydns Start the MyDNS server |
| 198 | +# |
| 199 | +# Author: Philipp Kern <phil@philkern.de>. |
| 200 | +# Based upon skeleton 1.9.4 by Miquel van Smoorenburg |
| 201 | +# <miquels@cistron.nl> and Ian Murdock <imurdock@gnu.ai.mit.edu>. |
| 202 | +# |
| 203 | + |
| 204 | +set -e |
| 205 | + |
| 206 | +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
| 207 | +DAEMON=/usr/local/sbin/mydns |
| 208 | +NAME=mydns |
| 209 | +DESC="DNS server" |
| 210 | + |
| 211 | +SCRIPTNAME=/etc/init.d/$NAME |
| 212 | + |
| 213 | +# Gracefully exit if the package has been removed. |
| 214 | +test -x $DAEMON || exit 0 |
| 215 | + |
| 216 | +case "$1" in |
| 217 | + start) |
| 218 | + echo -n "Starting $DESC: $NAME" |
| 219 | + start-stop-daemon --start --quiet \ |
| 220 | + --exec $DAEMON -- -b |
| 221 | + echo "." |
| 222 | + ;; |
| 223 | + stop) |
| 224 | + echo -n "Stopping $DESC: $NAME" |
| 225 | + start-stop-daemon --stop --oknodo --quiet \ |
| 226 | + --exec $DAEMON |
| 227 | + echo "." |
| 228 | + ;; |
| 229 | + reload|force-reload) |
| 230 | + echo -n "Reloading $DESC configuration..." |
| 231 | + start-stop-daemon --stop --signal HUP --quiet \ |
| 232 | + --exec $DAEMON |
| 233 | + echo "done." |
| 234 | + ;; |
| 235 | + restart) |
| 236 | + echo -n "Restarting $DESC: $NAME" |
| 237 | + start-stop-daemon --stop --quiet --oknodo \ |
| 238 | + --exec $DAEMON |
| 239 | + sleep 1 |
| 240 | + start-stop-daemon --start --quiet \ |
| 241 | + --exec $DAEMON -- -b |
| 242 | + echo "." |
| 243 | + ;; |
| 244 | + *) |
| 245 | + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 |
| 246 | + exit 1 |
| 247 | + ;; |
| 248 | +esac |
| 249 | + |
| 250 | +exit 0 |
| 251 | +--------------------------------------------------------------------------- |
| 252 | + |
| 253 | +# now execute: |
| 254 | + |
| 255 | +chmod +x /etc/init.d/mydns |
| 256 | +update-rc.d mydns defaults |
| 257 | + |
| 258 | +6) Install vlogger and webalizer |
| 259 | + |
| 260 | +apt-get install vlogger webalizer |
| 261 | + |
| 262 | +Change the following line in /etc/webalizer/webalizer.conf from |
| 263 | + |
| 264 | +#Incremental no |
| 265 | + |
| 266 | +to |
| 267 | + |
| 268 | +Incremental yes |
| 269 | + |
| 270 | +7) Install Jailkit (optional, only needed if you want to use chrroting for SSH users) |
| 271 | + |
| 272 | +apt-get install build-essential autoconf automake1.9 libtool flex bison debhelper |
| 273 | +cd /tmp |
| 274 | +wget http://olivier.sessink.nl/jailkit/jailkit-2.7.tar.gz |
| 275 | +tar xvfz jailkit-2.7.tar.gz |
| 276 | +cd jailkit-2.7 |
| 277 | +./debian/rules binary |
| 278 | +cd .. |
| 279 | +dpkg -i jailkit_2.7-1_*.deb |
| 280 | +rm -rf jailkit-2.7* |
| 281 | + |
| 282 | +8) Install fail2ban (optional but recomended, because the monitor tries to show the log) |
| 283 | +More info at: http://www.howtoforge.com/fail2ban_debian_etch |
| 284 | + |
| 285 | +apt-get install fail2ban |
| 286 | + |
| 287 | +9) Install ISPConfig 3 |
| 288 | + |
| 289 | +# There are two possile scenarios, but not both: |
| 290 | +9.1) Install the latest released version |
| 291 | +9.2) Install directly from SVN |
| 292 | + |
| 293 | +9.1) Installation of last version from tar.gz |
| 294 | + |
| 295 | + cd /tmp |
| 296 | + wget http://www.ispconfig.org/downloads/ISPConfig-3.0.0.9-rc2.tar.gz |
| 297 | + tar xvfz ISPConfig-3.0.0.9-rc2.tar.gz |
| 298 | + cd ispconfig3_install/install/ |
| 299 | + |
| 300 | +9.2) Installation from SVN |
| 301 | + |
| 302 | + apt-get install subversion |
| 303 | + cd /tmp |
| 304 | + svn export svn://svn.ispconfig.org/ispconfig3/trunk/ |
| 305 | + cd trunk/install |
| 306 | + |
| 307 | + |
| 308 | +9.1+9.2) Now proceed with the ISPConfig installation. |
| 309 | + |
| 310 | +# Now start the installation process by executing: |
| 311 | + |
| 312 | +php -q install.php |
| 313 | + |
| 314 | +# The installer will configure all services like postfix, sasl, courier, etc. for you. A manual setup as required for ISPConfig 2 (perfect setup guides) is not nescessary. To login to the ISPConfig controlpanel, open the following URL in your browser (replace the IP to match your settings!): |
| 315 | + |
| 316 | +http://192.168.0.100:8080/ |
| 317 | + |
| 318 | +# the default login is: |
| 319 | + |
| 320 | +user: admin |
| 321 | +password: admin |
| 322 | + |
| 323 | +# In case you get a permission denied error from apache, please restart the apache webserver process. |
| 324 | + |
| 325 | + |
| 326 | + |
| 327 | +---------------------------------------------------------------------------------------------------------- |
| 328 | +Optional: |
| 329 | + |
| 330 | +Install a webbased Email Client |
| 331 | + |
| 332 | +apt-get install squirrelmail |
| 333 | +ln -s /usr/share/squirrelmail/ /var/www/webmail |
| 334 | + |
| 335 | +Access squirrelmail: |
| 336 | + |
| 337 | +http://192.168.0.100/webmail |
| 338 | + |
| 339 | + |
| 340 | +To configure squirrelmail, run: |
| 341 | + |
| 342 | +/usr/sbin/squirrelmail-configure |
| 343 | + |
| 344 | +---------------------------------------------------------------------------------------------------------- |
| 345 | + |
| 346 | +Hints: |
| 347 | + |
| 348 | +debian 5.0 under openvz: |
| 349 | + |
| 350 | +VPSID=101 |
| 351 | +for CAP in CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE |
| 352 | +do |
| 353 | + vzctl set $VPSID --capability ${CAP}:on --save |
| 354 | +done |
| 355 | + |
| 356 | +---------------------------------------------------------------------------------------------------------- |
| 357 | + |
| 358 | + |
| 359 | +Optional recommended packages: |
| 360 | + |
| 361 | +denyhosts - a utility to help sys admins thwart ssh crackers |
| 362 | +rsync - fast remote file copy program (for backup) |
| 363 | + |
| 364 | +----------------------------------------------------------------------------------------------------------- |
| 365 | + |
| 366 | +Possible errors and their solutions |
| 367 | +------------------------------------ |
| 368 | + |
| 369 | +pureftpd login does not work. Take a look at the syslog, if you find an error message like this: |
| 370 | +Mar 24 16:26:28 ispconfig pure-ftpd: (?@?) [ERROR] Sorry, invalid address given |
| 371 | + |
| 372 | +then pureftpd is not able to resolve the hostname. Name resolving can be disabled with these commands: |
| 373 | + |
| 374 | +echo 'yes' > /etc/pure-ftpd/conf/DontResolve |
| 375 | +/etc/init.d/pure-ftpd-mysql restart |
| 376 | + |
| 377 | + |
| 378 | + |
| 379 | + |
| 380 | + |
| 381 | + |
0 commit comments