Monday, May 31, 2010

GTalk Setup Using Centerim

If you are spending most of your time using CLI like I do, you could try this tricks to enabling GTalk on centerim. Basically, GTalk is using jabber protocol. What you need to know is only the right parameter to fill in.

server: talk.google.com:5223
secured: yes
login: [your-account]@gmail.com
password: [your-password]

And leave all other settings as it is :)

Cacti Setup Guide on Mac OS X

1) Install PHP and MySQL 5 (not covered).  These instructions assume MySQL 5 was installed from MacPorts.

Check to make sure the PHP variable "mysql.default_socket" is set to path
   /opt/local/var/run/mysql5/mysqld.sock by viewing the output of this terminal command:
# php -i

If not, locate the php.ini file for your version of PHP and type the path there.

2) Set Cacti permissions.
# sudo chown -R : /opt/local/share/cacti/
3) Setup MySQL and prepare it for Cacti. Configure MySQL (new MySQL installs)
# sudo -u mysql /opt/local/lib/mysql5/bin/mysql_install_db
###########################################################
# A startup item has been generated that will aid in
# starting mysql5-server with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
###########################################################
--->  Installing mysql5-server @5.1.45_0
******************************************************
* In order to setup the database, you might want to run
* sudo -u _mysql mysql_install_db5
* if this is a new install
******************************************************

$ sudo -u _mysql mysql_install_db5
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql5/bin/mysqladmin -u root -h MacBook.local password 'new-password'
Alternatively you can run:
/opt/local/lib/mysql5/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/local/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script!

Start MySQL:
# sudo /opt/local/share/mysql5/mysql/mysql.server start

Set MySQL to start at system boot (optional)
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Set a root MySQL password. Follow the instructions that were given after you executed 'mysql_install_db' above.

Create a cacti MySQL user and cacti database.
# mysql5 -u root -p (login with new root password when prompted)
mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on cacti.* to cacti@localhost;
mysql> grant CREATE,INSERT,SELECT,DELETE,UPDATE on cacti.* to cacti;
mysql> SET PASSWORD FOR cacti@localhost = OLD_PASSWORD('');
mysql> create database cacti;
mysql> exit;

Import the cacti database.
# sudo cat /opt/local/share/cacti/cacti.sql | mysql5 -u root -p cacti (cacti is the db name)

Verify the Cacti Database.
#mysql5 -u root -p
mysql> use cacti;
mysql> show tables;
mysql> exit;
4) Edit /opt/local/share/cacti/include/config.php to match your MySQL information.

        $database_type = "mysql";
        $database_default = "cacti";
        $database_hostname = "localhost";
        $database_username = "cacti";
        $database_password = "";

5) Place a symlink for Cacti inside your Apache document root.
# ln -s /opt/local/share/cacti  /cacti
6) Edit the Cacti user's crontab file.
# sudo -u crontab -e

  Insert the crontab entry below:
        */5 * * * * /opt/local/bin/php /opt/local/share/cacti/poller.php > /dev/null 2>&1


8) If you installed Cacti with the 'plugins' variant for Cacti Plugin Architecture support, you must perform these additional steps.

   a) Import the PA schema.
        # cd /opt/local/share/cacti
        # sudo cat /opt/local/share/cacti/pa.sql | mysql5 -u root -p cacti (cacti is the db name)

   b) Download the particular Cacti plugin(s) you want and copy their folders to /opt/local/share/cacti/plugins//.
      For example:
        /opt/local/share/cacti/plugins/weathermap/

   c) Edit /opt/local/share/cacti/include/global.php - modify the url_path to reflect Cacti's default URL
      and add an entry to load each plugin you install; the weathermap plugin is an example:

        $config['url_path'] = '/cacti/';

        $plugins = array();
        $plugins = 'weathermap';

   d) Enable the plugin in the Cacti web interface; this creates a top-level tab for the plugin in the Cacti interface
        Console -> User Management  (select a Cacti user and check the 'View Weathermaps' checkboxes)

7) Go to http://localhost/cacti/install/index.php.
        The default user/password is admin/admin.  Select 'New Install', enter
        the paths for SNMP / RRDtool / PHP (see below), and click 'Finish'.
        You may now use Cacti at http://localhost/cacti/index.php.

Paths:
        snmpwalk binary path: /usr/bin/snmpwalk
        snmpget binary path: /usr/bin/snmpget

        RRDtool binary path: /opt/local/bin/rrdtool
        PHP binary path: /opt/local/bin/php (if not using MacPorts PHP, use appropriate path)

Wednesday, May 26, 2010

MySQL Load Problem Workaround on Ubuntu Server

Although I could say that using Ubuntu Server is easy, but apparently not all the setting-up things run well :)) Recently I've got problem with my MySQL Load. My web pages cannot connect to MySQL Server, but checking to connect from terminal don't have trouble at all.

After doing some googling, mine is working now. It seems that mysql 5.0 needs php5-mysqli rather than php5-mysql. Basically it involved editing the 'extension_dir' property in my php.ini file:
$ sudo vi /etc/php5/apache2/php.ini
for the 'extension_dir' property change /usr/lib/php5/20060613 to '/usr/lib/php5/ext' and save the file.

Now you have to create the directory:
$ sudo mkdir /usr/lib/php5/ext

And now copy your mysql.so file to this new directory under the new name mysqli.so:
$ sudo cp /usr/lib/php5/20060613/mysql.so /usr/lib/php5/ext/mysqli.so

Then restart Apache:
$ sudo /usr/sbin/apache2ctl restart

Monday, May 24, 2010

cPanel Configuration for MySQL Access

Case: cPanel user would like to hire web developer, want to give ftp access (for upload and download web files) and MySQL database access (the web is using Joomla) only.

These are the example:
- db name: cybi1_testing
- db username: cybi1_test
- pass: t3st1ng
- host: cybi.co.id (server Cohosting 1)

a. via terminal:



b. or via phpMyAdmin (available for Linux/ Unix, Windows and Mac/ other mySQL FrontEnd GUI:




Below are the steps to follow:
1. Create ftp account for the web developer, menu Files → FTP Accounts



Fill-in username, password, default directory dan capacity




2. Create new database, user and priviliges to access the database







3. Allowing host to access database, Databases → Remote MySQL




Enjoy.. :)