Featured Post

Organize and rename photos by EXIF data with PowerShell

This PowerShell script organizes and renames all photos in a selected folder using EXIF data. It will also create thumbnails of the images i...

Showing posts with label CentOS. Show all posts
Showing posts with label CentOS. Show all posts

Saturday, May 23, 2015

CentOS 6.x LAMP Server Provisioning Script

The first thing I do when a new server is born is download and execute this script to lock down iptables and do the basic configurations like creating an administrator account with sudo privileges.


Wednesday, May 7, 2014

Updating Drupal Core using Drush

Log into your server through SSH, and change directories to your root Drupal installation directory which contains the sites folder.

cd /home/myuser/public_html/

Run the following command which will ask you to confirm you want to update the found Drupal installation, enter "y" to finish

drush pm-update


Example Output:

sh-4.1$ drush pm-update
 Name    Installed Version  Proposed version  Message
 Drupal  7.26               7.27              SECURITY UPDATE available


Update information last refreshed: Wed, 05/07/2014 - 04:32
Code updates will be made to drupal core.
WARNING:  Updating core will discard any modifications made to Drupal core files, most noteworthy among these are .htaccess and robots.txt.  If you have made any modifications to these files, please back them up before updating so that you can re-create your modifications in the updated version of the file.
Note: Updating core can potentially break your site. It is NOT recommended to update production sites without prior testing.

Do you really want to continue? (y/n): y
Project drupal was updated successfully. Installed version is now 7.27.
Backups were saved into the directory /home/myuser/drush-backups/mysite/20140507150101/drupal.                    [ok]
No database updates required                                                                                      [success]
'all' cache was cleared.                                                                                          [success]
Finished performing updates.                                                                                      [ok]

Installing Drupal's Drush

Installing Drush on CentOS using Yum and PEAR

Check if PEAR is on the server:

pear version

If PEAR is not on the server then install using yum:

yum install php-pear

Prepare PEAR

sudo pear channel-discover pear.drush.org

Install:

sudo pear install drush/drush

Wednesday, October 16, 2013

Configuring Headless VirtualBox Server on CentOS 6.x

If you are starting on a blank server, I would recommend first using my Server Provisioning Script to get the server secured and updated.

The most important thing is to make sure that you have the Source available for your current Kernel.

Get current kernel information:

[user@server] uname -r

2.6.32-358.6.2.el6.x86_64

Get which kernels are installed:

[user@server] rpm -qa | grep kernel

kernel-devel-2.6.32-358.18.1.el6.x86_64 kernel-firmware-2.6.32-358.18.1.el6.noarch kernel-headers-2.6.32-358.18.1.el6.x86_64 dracut-kernel-004-303.el6.noarch kernel-2.6.32-358.0.1.el6.x86_64 kernel-2.6.32-358.18.1.el6.x86_64 kernel-2.6.32-358.14.1.el6.x86_64


In the example above I am using kernel 2.6.32-358.6.2.el6.x86_64 while the rpms that are installed are for a newer version 2.6.32-358.18.1.el6.x86_64

So, in this example, we must remove the newer rpms (18.1) and install the ones that match our current kernel (6.2). Note: You should only have to do this for the headers and not devel.

sudo yum remove kernel-headers-2.6.32-358.18.1.el6.x86_64

Now we can install the ones to match:

sudo yum install kernel-headers-2.6.32-358.6.2.el6.x86_64
sudo yum install kernel-devel-2.6.32-358.6.2.el6.x86_64

Now we can get on with the rest:

cd /etc/yum.repos.d
sudo wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
sudo rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

sudo wget http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6-8.noarch.rpm
sudo yum -y --enablerepo rpmforge install dkms

sudo yum -y groupinstall "Development Tools"

sudo reboot

Once the server reboots:

cd /etc/yum.repos.d
sudo wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
sudo yum -y install VirtualBox-4.2


cd /tmp
sudo wget http://download.virtualbox.org/virtualbox/4.2.8/Oracle_VM_VirtualBox_Extension_Pack-4.2.8-83876.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.8-83876.vbox-extpack


That should be it! Now you have VirtualBox 4.2 installed and ready to rock!

Monday, October 14, 2013

CentOS 6.x LAMP Server Provisioning Script


1) Log onto server as root
2) Download the latest version of the script using wget:
wget https://gist.github.com/dirte/5328929/raw/bd45dba4195147e026ffdd1d7557172bdcb72edb/provision_centos_server.sh

3) Set the script to be executable:

chmod +x ./provision_centos_server.sh

4) Execute the script:

./provision_centos_server.sh

Follow the scripts prompts and when it completes, reboot the server.

reboot

Once the server is rebooted, it will now no longer permit the root user to login through SSH. You will need to login using your admin user you created. Also, if you changed the SSH port, be sure to connect to the new port!

Note: There are further notes in the script on how to do initial configuration for Apache, MySQL and PHP. There is an 'exit' in the script before these notes, so if you want to use any of the commands there you will need to do so manually.