Database backup scripts

1. Database backup bash script
2. Perl email script
3. Cron job configuration to run the script

Here are some scripts that will help you make a database backup and than
another script that will send you an email, to confirm that the backup was made and probably if you want you can make the script send you the backup attached via email…
Then finally a cron configuration to run the database backup script everyday, week, month or once a year.

So here is the step by step tutorial…

First Lets make some directories..

1. Make a directory in /var/backups/ called sqlbackup

mkdir /var/backups/sqlbackup

Continue reading “Database backup scripts”

Securing SSH

The best way of Securing your server via ssh is to let connection just from ssh key.
So how we do that ?
Generate a ssh key pair on your computer

# ssh-keygen

now youll have 2 files id_rsa & id_rsa.pub
so what you have to do is change the id_rsa.pub to authorized_keys

# mv id_rsa.pub authorized_keys

Go to your server via ssh try to connect somewhere with ssh just so that you
create a .ssh folder on your home folder, or you can even do it manually than get back to your pc and:

# scp authorized_keys user@example.com:/home/user/.ssh/

You can do that also to root but anyway.
Continue reading “Securing SSH”

Enable Drupal URL cleaner

Thanks to James Michael Dupont I was able to enable my Drupal’s Site Url cleaner.
Actually first you have to enable mod_rewrite module, than edit your virtual host so that
it includes the .htaccess file, than edit your .htaccess file and reload apache.

What you should do first is enable mod_rewrite module

# a2enmod rewrite

Than to make it easier to work edit change .htaccess to htaccess.conf on your drupal folder (mine: /var/www/drupal-7.0)

# mv /var/www/drupal-7.0/.htaccess /var/www/drupal-7.0/htaccess.conf

Before including some lines on your vhost go to /var/log/apache2/ and create some log files:

# touch drupal7-rewrite.log drupal_access.log  drupal_error.log  drupal-rewrite.log

So now you have to include htaccess.conf in your vhost, by adding these lines: Continue reading “Enable Drupal URL cleaner”

PHP5 GD Bundled Support Fix

When Installing Open Atrium or Drupal sometimes noification show up this :

Atrium:
GD Image Filtering Low Quaity/Poor Performance
GD Image Rotation Low Quaity/Poor Performance

Drupal:
GD Library rotate and desaturate effects

It’s not such a big deal but anyway cant stand it I want everything looking green 😛
What we have to do is recompile php5 with bundled support for GD

Lets Start: Continue reading “PHP5 GD Bundled Support Fix”

Installing Apache on Linux

I’m Preparing this for my next tutorial about :
Installing and Configuring Drupal 7 on a Linux machine.
Installing Apache is easy just a few commands and you’re ready to sue it.
Note: Lamp Server doesn’t just install apache but also PHP/Perl/Python and MySQL

1. Type :

$ sudo tasksel install lamp-server

It will ask some passwords about Mysql just add them and proceed
after finishing go ahead and Continue reading “Installing Apache on Linux”

Fix SSH from disconnecting

I use ssh client a lot…Sometimes happens that it disconnects and to keep that session alive you can try this…

Global Configuration
open /etc/ssh/ssh_config file and add in the end :

ServerAliveInterval 60

Current user configuration
Do the same with  ~/.ssh/config file if you don’t have the file create it

Host *
ServerAliveInterval 60

Indent the second line with a space.

Per-host configuration
If you want to do this just for a single server then in ~/.ssh/config file type :

Host *hostname.com
ServerAliveInterval 60

Thanks, hope it helps !
content : HTG

Free Up disk space in Ubuntu

This tutorial will show you how to remove a lot of used space in your hard drive
Everytime Ubuntu updates or you install software the package manager downloads all the packages to the system, and then cashes them there in ccase they need ti be installed again. Unfortunately, this can often mean a real lot of wasted space.

First Check out the used space for yourseld, head into  /var/cache/apt/archives folder,
or just run the following command from the prompt:

$ du -sh /var/cache/apt/archives

You’ll see that there’s a lot of space being used there… Continue reading “Free Up disk space in Ubuntu”