WholeSite CentOS 6.2 Amazon EC2 AMI
Images (1)
 
 
 
 
 
WholeSite CentOS 6.2 Amazon EC2 AMI
 
Comment Now · Comments (2) · March 3, 2012 2:10 PM

Updated March 4, 2012

There is a bug I found with the email looking for the 'sieve' plugin in the wrong folder. Apply these changes.

vi /etc/dovecot/dovecot.conf
protocol imap {
  mail_plugin_dir = /usr/lib/dovecot
  mail_plugins =
}
protocol pop3 {
  mail_plugin_dir = /usr/lib/dovecot
  mail_plugins =
  pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  mail_plugin_dir = /usr/lib/dovecot
  mail_plugins = sieve
  postmaster_address = postmaster@example.com
}

 

 


I thought I would clean up and release a public version of the CentOS 6.2 Web Server I have been working on for a few weeks.

 

ami-58c41931

It contains Apache2, MySQL, Postfix, Dovecot, Amavisd, SpamAssasin, ISPConfig3, S3CMD, PureFTPD.

There are setup instructions you can follow in the '/root' folder.

I normally create this AMI in Amazon VPC with an instance size of m1.large, which runs at a cost of 0.34 cents per hour at the time I published this.

Let me know if you have any questions.

 

Here are the instructions to complete the setup once your instance is launched.

 

###################################################################
##
##  WholeSite EC2 AMI - CentOS 6.2 - v1.3
##
##  Chris Murphy
##  support@mtex.ca
##
##  www.wholesite.com
## 
##  March 1, 2012
##
###################################################################

Thanks for using this AMI. I built this from scratch following
parts of the Perfect Server setup and a bunch of other resources.

This is the article that outlines how this AMI was created.
http://chrisjames.ca/stuff/475d7e33-1550-0f94-d94d-e9a58344bc99/CentOS-62-x86_64-Web-Server-w-ISPConfig-Condensed-Setup-for-Amazon-EC2/

Once your instance is running follow these steps to have your
server running and ready to go.


## SETUP YOUR SERVER HOSTNAME
## (Change 'myserver.domain.com' in the following scripts)
## Run these commands from the shell.


echo "NETWORKING=yes" > /etc/sysconfig/network
echo "HOSTNAME=myserver.domain.com" >> /etc/sysconfig/network
hostname myserver.domain.com

echo "127.0.0.1   myserver.domain.com myserver localhost localhost.localdomain localhost4 localhost4.localdomain4" > /etc/hosts
echo "::1         myserver.domain.com myserver localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /etc/hosts
service network restart

vi /etc/amavisd/amavisd.conf
    ## Edit these lines
    $myhostname = 'myserver.domain.com';
    $mydomain = 'domain.com';


vi /etc/postfix/main.cf
    ## Edit these lines
    myhostname = myserver.domain.com
    mydestination = myserver.domain.com, localhost, localhost.localdomain

vi /etc/php.ini
    ## Edit your time zone if it's different from "America/Toronto"
    date.timezone = "America/Toronto"


## Rebuild PureFTPD Certificate with fully qualified server name
openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
chmod 600 /etc/ssl/private/pure-ftpd.pem

## Restart services
/etc/init.d/pure-ftpd restart
service amavisd restart
service httpd restart
service postfix restart


## SETUP ISPCONFIG
## Browse to http://[your-server-ip]:8080
## Under System > Server Services
    ## Select the server
    ## Update its 'Servername'
## Under System > Server Config  
    ## Select the server
    ## Update the IP Address (internal ip)
    ## Set the gateway
    ## Set Hostname
    ## Set nameservers
## Under System > Server IP addresses
    ## Select the server
    ## Update the IP Address (public ip)


NOTES:
#########################################################################

s3cmd is installed so you can upload files to your Amazon S3 bucket.
Run this to configure s3cmd:

s3cmd --configure



STORAGE:
#########################################################################

The server only has 10GB of disk space so be careful if you start loading it up
as you can run out of space quick.  The best way to handle this is to use the
ephemeral storage that is associated with a new instance.

Here is the process I have used to transfer the bulk of the servers storage
to a RAID0.

This is based on m1.large which comes with 2 attached 450GB drives for storage.

You can change the size of the volume created. Currently it is set to 800GB.

This storage will be gone if the instance crashes or is terminated, so backups
are critical. Don't tell me you were not told.

Create RAID 0 on Instance Store
http://www.youtube.com/watch?v=CoeRiwOS76M
http://agiletesting.blogspot.com/2011/05/setting-up-raid-0-across-ephemeral.html
--------------------------------------------------------------------------------


mkdir /data
mdadm --create /dev/md0 --level=0 --chunk=256 --raid-devices=2 /dev/xvdf /dev/xvdg

mdadm --detail /dev/md0
blockdev --setra 65536 /dev/md0
pvcreate /dev/md0
vgcreate vg0 /dev/md0
lvcreate --name data0 --size 800G vg0
mkfs.ext4 /dev/vg0/data0
mount -t ext4 /dev/vg0/data0 /data

service httpd stop
service mysqld stop
service postfix stop
service saslauthd stop
service dovecot stop
service amavisd stop

mkdir /data/tmp

cp -rp /var/log /data
mv /var/log /var/logOLD
ln -s /data/log /var/log

cp -rp /var/vmail /data
mv /var/vmail /var/vmailOLD
ln -s /data/vmail /var/vmail

cp -rp /var/www/html /data
mv /var/www/html /var/www/htmlOLD
ln -s /data/html /var/www/html

cp -rp /var/lib/mysql /data
mv /var/lib/mysql /var/lib/mysqlOLD
ln -s /data/mysql /var/lib/mysql

service httpd start
service mysqld start
service postfix start
service saslauthd start
service dovecot start
service amavisd start

vi /etc/rc.local
## Add this so the drives get remounted on reboot
/bin/mount -t ext4 /dev/vg0/data0 /data



TAGS: WholeSite, CentOS, Apache2, MySQL, Postfix, Dovecot, Amavisd, SpamAssasin, ISPConfig3, S3CMD, PureFTPD, Web Server, Amazon EC2, VPC
Views (369) · March 3, 2012
Comments (2)
 
Adam Newdow
I couldn't get the condensed setup working, I'm going to give this a try on another server, and see what I come up with. Thanks for this.
March 31, 2013 4:04 PM
 
Tuyre
Just looking at your entry for /etc/hostsNot sure why you have included myserver.domain.com in the localhost line.... this seems to be a security issue. Surely the domain name should not be tied into the localhost line.
February 15, 2013 7:12 PM
Leave a comment
 
*Name:

Email: (Only to notify you of updates to this conversation. That's it. It won't appear anywhere.)
* Comment: