Archive for the ‘Linux’ Category

Linux: Install Apache with Yum

Monday, August 16th, 2010
yum install httpd
yum install mod_ssl

Source: Installing Apache, PHP, and MySQL on Fedora Core

Linux: MySQL Install (with yum) & Run

Sunday, August 15th, 2010

Install via Yum

yum install mysql
yum install mysql-server

Run

service mysqld start

Set Root Password

mysqladmin -u root password MYPASSWORD

Change root Password

mysqladmin -u root -p'oldpassword' password newpass

Linux: Add User to Group

Friday, July 9th, 2010

Add group to user

usermod -a -G mygroup myuser

Change primary user group

usermod -g mygroup myuser

Source

Linux: FileSystem command tips

Saturday, January 23rd, 2010

List the file systems

df -h

Size given folder

du -sh /path/to/folder

Sort/List largest directories/subdirectories

du /var/log/ | sort -nr | less

Other Links

SSH: Configuring Pageant on Windows to automatically use a key

Thursday, November 19th, 2009
C:\PuTTY\pageant.exe d:\main.ppk 

source

Linux: IPTables

Sunday, September 27th, 2009

Enable HTTPS

iptables -I INPUT 1 -s 0/0 -i eth0 -d 0/0  -p TCP --dport 443 -j ACCEPT
  • -I INPUT 1: Insert at position #1 (do
  • -s 0/0: Any source IPs
  • -d 0/0: Any destination IPs
  • -p TCP: TCP protocol
  • –dport 443: Port number (for ssl, default is 443)

Related Links

Apache: Install SSL on Virtual Host

Sunday, September 27th, 2009

Here is the minimum configuration to enable SSL

Load the module and configure the certificate

LoadModule ssl_module modules/mod_ssl.so
Listen 443
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /path/to/domain-certificate.crt
SSLCertificateKeyFile /path/to/domain-key.key
SSLCertificateChainFile /path/to/bundle-certificate.crt
SSLCACertificateFile /path/to/bundle-certificate.crt

….

NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot /path/to/html/
ServerName www.mysecuredomain.com
SSLEngine on
</VirtualHost>

Pre-requisites:

  1. Disable your /etc/httpd/conf.d/ssl.conf by renaming it to ssl.conf.disabled (otherwise, Apache will take the properties from this file, and it can get quite confusing).
  2. Open your firewall for https protocol
  3. Get a certificate (Godaddy have the cheapest one, especially for wildcard ones)

Related links

Linux: Tar cheat sheets

Monday, September 7th, 2009

Tar and gzip the folder panda/ in the panda.tar.gz

tar -cvzf panda.tar.gz panda/

Untar

tar -xvzf panda.tar.gz

or (to change the base folder name)

tar -xvzf latest.tar.gz -C ./(folder name)

Source: lowfatlinux.com

MySQL: Shell script to backup mysql database

Monday, September 7th, 2009
tdy=`date +%Y-%m-%d-%H-%M`
mkdir /var/backup/db_name/$tdy
mysqldump -u db_user -p --opt db_name > /var/backup/db_name/$tdy/db_name-$tdy.sql

Apache: SSL Certificate generate CSR

Friday, August 7th, 2009

CSR-Generation Instructions

To generate a triple-DES encrypted key pair and a Certificate Signing Request (CSR):

Enter the following commands:

  1. cd /usr/bin/ (/your path to openssl/)
    Enter a passphrase when prompted to.
  2. openssl genrsa -des3 -out <name of your certificate>.key 1024
  3. openssl req -new -key <name of your certificate>.key -out <name of your certificate>.csr

If you are requesting a Wildcard certificate, please add an asterisk (*) on the left side of the Common Name (e.g., “*.domainnamegoes.com” or “www*.domainnamegoeshere.com”). This will secure all subdomains of the Common Name.

(source: Godaddy’s help)

BTW, Godaddy has the cheapest certificates you can find (with great support).