Archive for the ‘Linux’ Category

Linux: Resize (extend) a Logical Disk in a Xen from DOM0

Saturday, May 14th, 2011

Assuming you have set your xen VM (e.g. domu1) points to a logical volume.

from DOM0

Extending the domu1 logical volume to 40G

lvextend -L40G /dev/vg0/domu1

from domu1

Resize the Physical Disk

pvresize /dev/hda

Resize the desired LV

lvextend -L15G /dev/vg0u/store
// might want to unmount the volume first, but this works on ext3 on live disk
resize2fs /dev/vg0u/store

See also

LVM Guide

Linux: Bash Shell script, variable, if/else, echo

Monday, November 29th, 2010

Great tutorial: Bash Scripting Tutorial

Test if a parameter is defined

test.sh

#!/bin/bash
if [ -n "${1}" ]; then
  echo $1
else
  echo "hum, nothing"
fi

test.sh will output “hum, nothing”

test.sh foo will output “foo”

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