Upgrade phpBB forum

1) Download the full package from http://www.phpbb.com/downloads.php, unpack it to a temporary folder, say, /tmp/phpBB2

2) Copy the new package to a temporary folder
$ cp -R /tmp/phpBB2 ppp

3) Copy the old config.php file
$ cp forum/config.php ppp

4) Install the new package: point the browser to http://mydomain.com/ppp/install/update_to_latest.php

5) Remove the install/ and contrib folder
$ rm -rf ppp/install/ ppp/contrib/

6) Copy chinese language package
$ cp -R forum/language/lang_chinese_simplified/ ppp/language

7) Modify logo location, and replace it with the correct logo
$ vi forum/templates/subSilver/overall_header.tpl ppp/templates/subSilver/overall_header.tpl
and search key word logo to find the correct line

8) Copy the Avitar folder
$ cp -R forum/images/avatars/gallery/Avatar_pack_1/ ppp/images/avatars/gallery/

9) Test the new forum at http://mydomain.com/ppp. Remove the old folder if everything looks fine
$ mv forum /tmp/forum.mydomain; mv ppp forum

10) To fight spam registration, I also changed the keyword “agreed” in all files to some other word.

System memory

Copied from the now diseased Dinix web forum:

How can I tell what is using up all of my server’s memory?
Linux actually uses two different forms of disk caching, referred to as ‘cached’ and ‘buff’ in top. The amount of free memory displayed by the program top is misleading, since the Linux operating system will use most of the available memory for disk caching.

When you launch new processes, Linux will automatically shrink the cache to free up needed memory. If more memory is needed
after Linux has shrunk the disk cache, Linux will swap out currently unused portions of memory to disk.

Swapping out parts of a process’ memory is the reason for the difference between the SIZE and RSS columns for some
processes listed in top. The SIZE column is the amount of memory allocated to the process that can reside in physical memory
or on the swap partition. The RSS column shows how much of a process’ memory resides in physical memory. (The SIZE column
may actually show less memory than the process has requested, since Linux will wait to assign a unit of memory to the process
until the process has accessed memory inside that unit by reading or writing to it.)

Linux will move data from the swap partition back into physical memory once a process requires that piece of data. This is why
the data may remain on the swap partition even though enough physical memory has been freed to contain all the processes.

If you want to know how much physical memory your programs our actually using, you can subtract the ‘cached’ and ‘buff’
fields in top from the used memory field. Conversely, you can add the ‘cached’ and ‘buff’ fields to the free memo

MySQL most used commands

Started with system database of mysql

$ mysql -uroot -ppassword mysql

Create a database:

mysql> CREATE database mydb
mysql> drop database mydb;
mysql> show databases;

Corresponding Unix system command

$ mysqladmin drop mydb
$ mysqlshow

To add password

$ mysqladmin password xxxx

To export database

$ mysqldump -u myuser -pmypass mydb > exl.sql

To add a user to a database:

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on mydb.* to 'myuser'@'localhost' IDENTIFIED BY 'mypassword';

or

mysql> INSERT INTO user (Host,User,Password) VALUES('localhost','dummy','mypassword');

To add a user that can access from other client machines, use % as the host

mysql> GRANT SELECT on db1.* to 'myuser'@'%' IDENTIFIED BY 'mypassword';

To change password, use

mysql> update user set password=PASSWORD(“NEW-PASSWORD”) where User=’myuser’;

To change permissions, use

mysql> GRANT USAGE ON *.* TO 'dummy'@'localhost';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on mydb.* to myuser;

or

mysql> GRANT ALL on mydb.* to myuser
mysql> FLUSH PRIVILEGES;

— special for loading file

mysql> GRANT FILE on *.* to myuser
mysql> LOAD DATA INFILE '/mypath/myfile' INTO TABLE mytable FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';

To check the error such as the infamous “ERROR 1005 (HY000)”, use

mysql> SHOW ENGINE INNODB STATUS