Tag Archives: CentOS

Goodbye Docker on CentOS. Hello Ubuntu!

I have been a hardcore CentOS user for many years now. I enjoyed its minimal install to create a light environment, intuitive installation process, and it’s package manager. Docker is the most popular container format today and provides developers and enthusiasts with an easy way to run workloads in containerized environments. I started using Docker in production at home for about a year now for services such as Plex Media Server, Web Server for this blog, ZNC, MineCraft, and MySQL to name a few. A Dockerfile is a set of instructions used to create a Docker image. I invested many hours creating perfect Dockerfiles using CentOS and Fedora to make deployments simple on any operating system. However, a personal revolution was brewing.

Continue reading Goodbye Docker on CentOS. Hello Ubuntu!

Using LVM cache on Linux with a RAM disk

The Challenge

This is a follow up article from using a USB drive for a LVM cache. I decided to test things further by using a RAM disk instead of a USB drive.

 

The Journey

1. Create a RAM disk:

modprobe brd rd_nr=1 rd_size=4585760 max_part=0

2. Create the cache

pvcreate /dev/ram0
vgextend vg /dev/ram0
lvcreate -L 300M -n cache_meta vg /dev/ram0
lvcreate -L 4G -n cache_vol vg /dev/ram0
lvconvert –type cache-pool –poolmetadata vg/cache_meta –cachemode=writeback vg/cache_vol -y
lvconvert –type cache –cachepool vg/cache_vol vg/docker-pool

3. Run the DD test again

[root@tokyo /]# dd if=/dev/zero of=/tmp/1G bs=1M count=1000
1048576000 bytes (1.0 GB) copied, 1.89586 s, 553 MB/s
[root@tokyo /]# dd if=/dev/zero of=/tmp/1G bs=1M count=1000
1048576000 bytes (1.0 GB) copied, 1.79864 s, 583 MB/s
[root@tokyo /]# dd if=/dev/zero of=/tmp/1G bs=1M count=1000
1048576000 bytes (1.0 GB) copied, 0.922467 s, 1.1 GB/s
[root@tokyo /]# dd if=/dev/zero of=/tmp/1G bs=1M count=1000
1048576000 bytes (1.0 GB) copied, 1.33757 s, 784 MB/s

Average Speed: 736 MB/s

 

Conclusion

In Conclusion, my average write speed is 736 MB/s using LVM caching with a RAM disk. With a USB thumb drive, my average speed is 411.25 MB/s. With no cache, my average speed is 256 MB/s.

 

 

Installing OpenStack on CentOS

I finally got OpenStack installed correctly after struggling with their documentation and the guides online. I wanted to share these steps with the everyone to ease the pain.

 

1. Install Epel Repo

 

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

 

Continue reading Installing OpenStack on CentOS

Improving IO performance on Linux

I purchased a new server and have been struggling with IO performance on a RAID 1 setup. I first tried RAID 5 but it was horrible. Through all my struggles, I found a few kernel and filesystem tunables that helped me out.

The virtual machines improved also. They were barely usable.

Filesystem Tweaks: /etc/fstab

Change your mount options to:

defaults,noatime,data=writeback,barrier=0,nobh
Linux Kernel tunables:
sysctl -w vm.swappiness=0
sysctl -w vm.dirty_background_ratio=5
sysctl -w vm.dirty_ratio=5
sysctl -w vm.vfs_cache_pressure=200
The dirty tunables controls the portion of memory that the kernel will store pages in. I decreased the value to 5 so that I will have more memory free.  The cache_pressure tunable tells the kernel how to quickly free up the cache.

Dovecot/Postfix Email Server setup with Gmail Relay

I have been struggling to get an email server setup and working by following many guides online. Here is how I got it working. I had to use Gmail as an relayhost to actually send the email from the server because my ISP blocks me from sending mail on port 25 and doesn’t allow me to relay mail through their servers because I’m using me@mydomain.com instead of me@isp.com)

Software: postfix and dovecot
Operating System: CentOS and Archlinux
(CentOS users need to install cyrus-sasl-plain also )

SASL Configuration

Modify or create: /usr/lib/sasl2/smtpd.conf

pwcheck_method:saslauthd
saslauthd_path: /var/run/saslauthd/mux
SASLAUTHD_OPTS=”${SASLAUTH_MECH} -a pam”
mech_list: plain login
log_level: 7

Dovecot Configuration

Copy the dovecot configuration files :

# cp /usr/share/doc/dovecot/example-config/* /etc/dovecot/

Modify /etc/dovecot/dovecot.conf:

protocols = imap

Modify: /etc/dovecot/conf.d/10-auth.conf :

disable_plaintext_auth = no

Modify: /etc/dovecot/conf.d/10-mail.conf :

mail_location = maildir:~/Maildir

Create or Modify: /etc/pam.d/dovecot

auth required pam_unix.so nullok
account required pam_unix.so

Postfix Configuration

Modify /etc/postfix/main.cf:

myhostname = rusher81572.com
mydomain = rusher81572.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost = [smtp.gmail.com]:587
home_mailbox = Maildir/
smtp_use_tls=yes
smtp_sasl_auth_enable = yes

smtpd_sasl_auth_enable = yes

smtp_sasl_password_maps = hash:/etc/postfix/password

smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_sasl_security_options =
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,check_relay_domains

Create /etc/postfix/password:

[smtp.gmail.com]:587 username:password

#postmap /etc/postfix/password

#systemctl start postfix

Create a DHCP and DNS server with RedHat/ CentOS Linux

#yum -y install bind bind-utils dhcp

 

Tell what interface to use with dhcpd:   /etc/sysconfig/dhcpd

DHCPDARGS=eth2

 

In /etc/named.conf add: (Modify to suit the following)

allow-query     { any; };

allow-recursion {any; };

listen-on port 53 { 10.10.10.2; };

 

Add this zone near the bottom:

 

zone “dhcpserver” IN {

type master;

file “dhcpserver”;

allow-update { any; };

notify no;

};

 

Create /var/named/dhcpserver:

 

@       IN      SOA     dhcpserver. hostmaster.dhcpserver. (

2012080701      ; Serial

43200      ; Refresh

3600       ; Retry

3600000    ; Expire

2592000 )  ; Minimum

;       Define the nameservers and the mail servers

IN      NS      dhcpserver.

IN      A       10.10.10.2

ns            IN      A       10.10.10.2

www        IN      A       10.10.10.2

client        IN      A       10.10.10.3

gateway        IN      A       10.10.10.2

 

Only have this in /etc/dhcp/dhcpd.conf:

 

subnet 10.10.10.0 netmask 255.255.255.0 {

option routers                  10.10.10.2;

option subnet-mask              255.255.255.0;

option domain-name              “dhcpserver”;

option domain-name-servers       10.10.10.2;

option time-offset              -18000;     # Eastern Standard Time

range 10.10.10.20 10.10.10.30;

}

 

#chkconfig named on

#chkconfig dhcpd on

#service named start

#service dhcpd start