Vilas Computer Services

Web

AMP installs

---------------- Debian ---------------
http://library.linode.com/lamp-guides/debian-5-lenny

---------------- OpenBSD ---------------
http://www.h-i-r.net/p/hirs-secure-openbsd-apache-mysql-and.html

---------------- RedHat ---------------
http://www.howtoforge.com/quick-n-easy-lamp-server-centos-rhel

MySQL

---------------- Install ---------------
#after installling mysql binaries, secure the installation
mysql_secure_installation

---------------- Tables ---------------
#check mysql table for consistency (-s silent)
myisamchk -s *.MYI

#repair mysql table (-q quick)
myisamchk -r -q jos_session.MYI

---------------- Logs ---------------
#clear mysql logs
mysql -u root -p 'mysqlpassword' -e "PURGE BINARY LOGS BEFORE '2010-05-01 10:00:00';"

---------------- Passwords ---------------
#setting root password that has not been set
$ mysqladmin -u root password NEWPASSWORD

#updating root password
$ mysqladmin -u root -p'oldpassword' password newpass

#example, If old password is xxxx, and new password will be yyyy, enter:
$ mysqladmin -u root -p'xxxx' password 'yyyy'

#change a user password on command line
$ mysqladmin -u myusr -p oldpassword password newpass

#to update or change password for user myusr w/sql command
1) Login to mysql server, type following command at shell prompt:
$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;

3) Change password for user myusr:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='myusr';

4) Reload privileges:
mysql> flush privileges;
mysql> quit

PHP

#contents of test.php
phpinfo();
?>

Shell

#change permissions on files and directories
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;