Install tmux on CentOS 6

tmux is a terminal emulator. It work like screen, but have more features.

CentOS 6 do not come with tmux, you need to enable rpmforge repository.

http://repoforge.org/use/

On CentOS 6 64 bit, run

Amazon Auto Scaling Protection

Prevent an EC2 Instance getting Terminated by AutoScale

You may need to update software on an instance in Amazon EC2 Auto Scaling Groups, when this happens make sure you enable “Scale In Protection” or your instance can get deleted by Auto Scaling group.

There is also an option for Standby mode. This option is also helpful for updating software on an instance. When instance is in Sandby mode, it won’t serve any requests. If its “Scale In Protection”, it will serve traffic, you will be able to debug any issues on this instance.

To enable protection, go to

EC2 Console > AUTO SCALING > Auto Scaling Groups

Select your Auto Scaling group.

Amazon Auto Scaling Protection

Click on instance you need to protect or set to standby. Then click on Actions, you have options to set the EC2 Instance in Standby mode or enable “Scale in Protection”

Delete Amazon S3 bucket

Delete Amazon S3 Bucket

To delete an Amazon S3 bucket, go to

Amazon Console > S3

Click on the bucket you need to delete. Then click on Delete button. You have option to empty the bucket if needed.

Delete Amazon S3 bucket

See Amazon S3

Amazon S3 permission

Make Amazon S3 Bucket public

To make an Amazon S3 bucket public, go to

Amazon Console > S3 > Bucket > Permission

Amazon S3 permission

Click on Permissions

Amazon S3 Bucket Policy

Click “Bucket policy”

Amazon S3 Policy editor

You get a blank editor. To make the bucket public, paste following code

Replace with your actual S3 Bucket name.

See Amazon S3

WordPress CDN Setup W3 Total Cache

Enable Amazon Cloudfront CDN in WordPress

I was setting up a wordpress web site to use Amazon S3 + Cloudfront as CDN. I used w3 total cache plugin for this. w3 total cache plugin have option to auto create Amazon S3 bucket and cloudfront distribution, for for this, you need to give Amazon AWS API keys.

WordPress CDN Setup W3 Total Cache

Clicking the button “Create as new bucket with distribution” will auto create s3 bucket and cloudfront for you.

if you site have images already uploaded, you need to upload them to Amazon S3. This can be done with W3 Total Cache.

Upload WordPress media to CDN

If you have lot of files, upload may fail. You may need to use Amazon AWS CLI tool to do the upload.

If needed, you can upload themes and plugins folder too

Install Amazon AWS awscli

awscli is a command line tool for Amazon AWS. To install, run

You can find more details at

https://docs.aws.amazon.com/cli/latest/reference/

Once installed, you need to configure it

To sync content of a folder to Amazon S3 bucket, run

Whitelist IP in AWS security group using awscli
Amazon AWS create key pair using awscli
AWS Cloud​Formation

See aws

webmin

Webmin is an open source control panel to manage Linux and FreeBSD servers.

http://www.webmin.com

Download Latest source distribution from

http://www.webmin.com/download.html

To install webmin in Ubuntu/debian, edit

Add

Add GPG key

Install webmin with apt

LetsEncrypt SSL for webmin server
Webmin create new admin user from command line

See Hosting Control Panel

Enable sar in Ubuntu

On Ubuntu, when i run sar, i get error

This is because sysstat is not enabled by default on Ubuntu, to enable, edit file

Find

Replace with

Now restart sysstat

See sar