Thursday, October 23, 2008
Friday, October 17, 2008
Enable SSH in VMware ESX 3.x
ESXi 3.5 does ship with the ability to run SSH, but this is disabled by default (and is not supported). If you just need to access the console of ESXi, then you only need to perform steps 1 - 3.
1) At the console of the ESXi host, press ALT-F1 to access the console window.
2) Enter unsupported in the console and then press Enter. You will not see the text you type in.
3) If you typed in unsupported correctly, you will see the Tech Support Mode warning and a password prompt. Enter the password for the root login.
4) You should then see the prompt of ~ #.
Edit the file inetd.conf (enter the command vim /etc/inetd.conf).
5) Find the line that begins with #ssh and remove the #. Then save the file.
6) Once you've closed the vi editor, run the command /sbin/services.sh restart to restart the management services. You'll now be able to connect to the ESXi host with a SSH client.
Monday, September 22, 2008
Disable Beep in Ubuntu Hardy
Open the file /etc/modprobe.d/blacklist as root in a text editor:
vim /etc/modprobe.d/blacklist
Add this line to the end of the file:
blacklist pcspkr
The next time Ubuntu boots up pcspkr will be blocked from loading and you will no longer hear the beep. Peace and quiet at last!
But if you only need a temporary solution to disable the beep, just run this command (as root):
modprobe -r pcspkr
Thursday, September 18, 2008
Make Hostname permanent in Strato - Debian
[ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
to:
[ -f /etc/hostname ] && HOSTNAME="YOURHOSTNAME"
Monday, September 15, 2008
Setting POP3 Connector & email server
http://www.microsoft.com/downloads/details.aspx?FamilyId=7B1FF109-092E-4418-AA37-A53AF7B8F6FC&displaylang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=206e4e32-1e37-4836-b4f7-8d6a543a7c7f&DisplayLang=en
Follow this link:
http://www.msexchange.org/tutorials/Configuring-Incoming-Outgoing-Email-Windows-Small-Business-Server-2003.html
Friday, August 29, 2008
Enable HTTPS in Debian
apt-get install libapache-mod-ssl
Enable ssl mode in Apache:
a2enmod ssl
add port 443 in /etc/apache2/ports.conf:
Listen 443
Make certificate (after run this command you must answer some questions):
make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
add these lines to
/etc/apache2/sites-available/YOURSERVER.COM.conf:
>
. . .
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
. . .
>/VirtualHost>
restart Apache2.
To redirect HTTP to HTTPS add these lines to
/etc/apache2/sites-available/YOURSERVER.COM.conf under 443 options:
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 2
and restart Apache2 again!
ftp user in a jail
make sure following line exists (and uncommented):
chroot_local_user=YES
Save and close the file. Restart vsftpd.
Tuesday, August 19, 2008
Windows Vista - Clear cache for dead offline files
Add the FormatDatabase (DBWD) registry entry to the following registry subkey:
(First add Parameters under Csc, if doesn't exist)HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Csc\Parameters
Then, set the FormatDatabase registry entry to 1.
The restart your computer.
Monday, August 18, 2008
Bacula automatic startup
#!/bin/sh
case "$1" in
'start')
/etc/bacula/bacula start
;;
'stop')
/etc/bacula/bacula stop
;;
*)
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
add these links as follows:
ln -s /etc/init.d/bacula /etc/rc2.d/S90bacula
ln -s /etc/init.d/bacula /etc/rc3.d/S90bacula
ln -s /etc/init.d/bacula /etc/rc4.d/S90bacula
ln -s /etc/init.d/bacula /etc/rc5.d/S90bacula
ln -s /etc/init.d/bacula /etc/rc0.d/K90bacula
ln -s /etc/init.d/bacula /etc/rc1.d/K90bacula
ln -s /etc/init.d/bacula /etc/rc6.d/K90bacula
or simply run:
update-rc.d bacula defaults 90
Friday, August 15, 2008
Heartbeat - DRBD - MYSQL - APACHE - TYPO3
On both boxes exists two pure partitions: /dev/sdb and /dev/sdc
Install these packages on both:
apt-get install heartbeat-2 drbd8-utils stonith mysql-server apache2
apt-get install typo3-base typo3-env
apt-get install php5 php5-cgi php5-mysql typo3-site-installer
Here is my /etc/drbd.conf:
resource testing { # name of resources for mysql database
protocol C;
on ubuntu-five { # first server hostname
device /dev/drbd0; # Name of DRBD device
disk /dev/sdb1; # Partition to use, which was created using fdisk
address 10.66.66.22:7788; # IP addres and port number used by drbd
meta-disk internal; # where to store metadata meta-data
}
on ubuntu-six { # second server hostname
device /dev/drbd0;
disk /dev/sdb1;
address 10.66.66.26:7788;
meta-disk internal;
}
disk {
on-io-error detach;
}
net {
max-buffers 2048;
ko-count 4;
}
syncer {
rate 10M;
al-extents 257;
}
startup {
wfc-timeout 0;
degr-wfc-timeout 120; # 2 minutos.
}
}
resource typo3 { # name of resources apache2 and typo3
protocol C;
on ubuntu-five { # first server hostname
device /dev/drbd1; # Name of DRBD device
disk /dev/sdc1; # Partition to use, which was created using fdisk
address 10.66.66.22:7789; # IP addres and port number used by drbd
meta-disk internal; # where to store metadata meta-data
}
on ubuntu-six { # second server hostname
device /dev/drbd1;
disk /dev/sdc1;
address 10.66.66.26:7789;
meta-disk internal;
}
disk {
on-io-error detach;
}
net {
max-buffers 2048;
ko-count 4;
}
syncer {
rate 10M;
al-extents 257;
}
startup {
wfc-timeout 0;
degr-wfc-timeout 120; # 2 minutos.
}
}
Here is my /etc/ha.d/ha.cf:
logfile /var/log/ha-log
keepalive 2
deadtime 30
udpport 695
bcast eth0
auto_failback off
stonith_host ubuntu-five meatware ubuntu-six
stonith_host ubuntu-six meatware ubuntu-five
node ubuntu-six ubuntu-five
and the /etc/ha.d/haresources:
ubuntu-five IPaddr::10.66.66.74/24/eth0\
drbddisk::testing Filesystem::/dev/drbd0::/var/lib/mysql::ext3\
drbddisk::typo3 Filesystem::/dev/drbd1::/data::ext3 mysql apache2
First make new Partitions on sdb and sdc on both boxes:
fdsik /dev/sdb
> n
> p
> 1
> enter
> enter
> w
fdsik /dev/sdc
> n
> p
> 1
> enter
> enter
> w
make drbd with these commands on both boxes:
drbdadm create-md testing
#mkfs.ext3 /dev/drbd0
drbdadm create-md typo3
(#mkfs.ext3 /dev/drbd1)
On ubuntu-five run:
drbdadm -- --overwrite-data-of-peer primary all
drbdadm connect all
On ubuntu-six run:
drbdadm -- --overwrite-data-of-peer secondary all
drbdadm connect all
Wait until new DRBD drive to syncing.
Move the mysql data files and test mounting on ubuntu-five:
/etc/init.d/mysql stop
mv /var/lib/mysql /var/lib/mysql.org
mkdir /var/lib/mysql
mount /dev/drbd0 /var/lib/mysql
mv /var/lib/mysql.org/* /var/lib/mysql/
chown -R mysql:mysql /var/lib/mysql
/etc/init.d/mysql start
On ubuntu-six do:
/etc/init.d/mysql stop
mv /var/lib/mysql /var/lib/mysql.org
Now start ubutnu-six after the ubuntu-five completely came up.
End :)
Thursday, August 14, 2008
Cloning typo3 Site
Make links for typo3 folders.
Backup database in source:
mysqldump -u {user} -p {databasename} > typo3_db.sql
Copy the file typo3_db.sql to destination.
Build new database in destination:
mysql -u root -p
mysql> grant all privileges on {datenbankname}.* \
to {username}@localhost identified by '{passwort}';
mysql> quit ;
mysql -u {username} -p
mysql> create database {databasename};
mysql> quit ;
mysql -u {username} -p {databaseame} < typo3_db.sql
Monday, August 11, 2008
Ubuntu - Change eth0 to eth1
vim /etc/udev/rules.d/70-persistent-net.rules
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bf:c8:1b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bf:c8:1b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
delete eth0 line, and change eth1 line to eth0:
Tuesday, August 5, 2008
MySQL Clustering - Master / Slave
for example:
hostname: IP
--------------------------------------
ubuntu-one: 10.66.66.36
ubuntu-two: 10.66.66.29
To begin with we'll install and configure MySQL for normal use on each of the boxes.
sudo apt-get install mysql-server --yes Set a strong MySQL root password and wait for the packages to download and install, then edit /etc/mysql/my.cnf to make MySQL listen on all IP addresses.
bind-address = 0.0.0.0 Now restart MySQL and fire up the MySQL command-line client to check all is good.
sudo /etc/init.d/mysql restart
mysql -u root -p
Enter password: [enter the MySQL root password you chose earlier]
mysql> If you got the mysql> prompt then MySQL is running. Try connecting to the other node across the network to see if the firewall is opened and MySQL is listening on the network interface.
From ubuntu-one run:
mysql -h ubuntu-two -u root -p
Enter password: [enter the MySQL root password you chose earlier]
ERROR 1130 (00000): Host 'db-01' is not allowed to connect to this MySQL serverIf you got the above error then everything is working fine - MySQL connected and refused to authorise the client.The first thing we want to do is setup a simple master-slave
replication to see that it's possible to replicate data from one
database host to the other. This requires a binary log so tell MySQL on
ubuntu-one to keep one. Edit /etc/mysql/my.cnf and set the following values under the replication section:server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = my_application <=== Database to replicate
binlog_ignore_db = mysql<=== Database to ignorebinlog_ignore_db = test<=== Database to ignoreOn ubuntu-one grant\
replication slave rights to ubuntu-two.
Changesome_passwordto a real, strong password.
Afterwards, make sure you restart MySQL.mysql -u root -p
Enter password: [enter the MySQL root password you chose earlier]
mysql> grant replication slave on *.* to 'replication'@'ubuntu-two' identified by 'some_password';
sudo /etc/init.d/mysql restart
Jump on to ubuntu-two and set it up to replicate data from ubuntu-one by editing /etc/mysql/my.cnf, again replacing the hostname, username and password with the values for ubuntu-one.
server-id = 2
master-host = ubuntu-one
master-user = replication
master-password = some_password
master-port = 3306One way replication should now be setup. Restart MySQL and check the
status of the slave on ubuntu-two. If the Slave_IO_State is "Waiting for
master to send event" then you've been successful.# Run this on ubuntu-two only
sudo /etc/init.d/mysql restart
mysql -u root -p
Enter password: [enter the MySQL root password you chose earlier]
mysql> show slave status ;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 193.219.108.241
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 98
Relay_Log_File: mysqld-relay-bin.000004
Relay_Log_Pos: 235
Relay_Master_Log_File: mysql-bin.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 98
Relay_Log_Space: 235
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0