Monday 16 September 2013

Increasing Java Memory



Hi All


This problem is resolved by adding  OPENFIRE_OPTS="-Xmx1512m"


in /etc/sysconfig/openfire file I restarted the services after that


Thanks a lot all of you for  your support  Now arround 1200 users are accessing this server from 3 different location in India


and IT is working nice


Thank you all

Source : http://community.igniterealtime.org/thread/30011

Friday 13 September 2013

Move MySQL Directory to Another Location

Lets say your MySQL data has fully utilized the disk space and you have another new hard disk specifically mounted for this purpose, you will need to migrate the data over to this new location. By default, MySQL will occupied following locations in the server:

    Data -/var/lib/mysql
    Config – /etc
    Log -/var/log


We will not migrate data in /etc or /log because it usually not required much space. I will use following variables:

    Server OS: CentOS 5.6 64bit
    Old MySQL data: /var/lib/mysql
    New MySQL data: /mnt/disk1/mysql


Warning: You MUST able to afford downtime on MySQL service to do this!

1. First of all, we need to make sure the service is stopped (if you are running cPanel, please disable MySQL monitoring under WHM > Service Manager > Untick ‘monitor’ for MySQL):

[root@centos ~]# service mysql stop

2. Make sure there is no MySQL services running on the server:

[root@centos ~]# ps aux | grep mysql | egrep -v 'grep'

3. Lets copy over the data directory. We are using rsync command so we can see the copy progress with estimate time remaining (this is really good for monitoring), and also preserve the permission and ownership of the MySQL directory:

[root@centos ~]# rsync -avpP /var/lib/mysql /mnt/disk1/mysql


4. Now we need to tell MySQL to look at new data directory. Open /etc/my.cnf via text editor and change following server options:

[mysqld]
......
datadir=/mnt/disk1/mysql
socket=/mnt/disk1/mysql/mysql.sock

......

5. Now lets start back the MySQL with this new settings:

[root@centos ~]# service mysql start


If everything are running back as expected, you can then delete the old /var/lib/mysql directory so you can save more free space.

Source : http://blog.secaserver.com/2011/07/move-mysql-directory-to-another-location/

====================XXXXXXXXXXXXXXXX========================

How to symlink /var/lib/mysql if /var mount becomes full


Most of you may already know how to do this, so forgive if this is too simple, but this may be helpful for some dedicated server owners whose /var mount (some hosts use separate partitions for /usr, /var, /home etc) has become full, which is usually do to large databases in /var/lib/mysql. There is usually plenty of room in /the /home partition. This will work on cPanel servers as well.

This simple tutorial lays out the steps involved to copy contents of /var/lib/mysql to /home and then symlink /var/lib/mysql to /home/mysql. Of course adjust accordingly if moving/symlinking to a different mount or directory.

1) Go to webpage that uses mysql to verify working pre-copy

2) Stop mysql service (I will usually also stop cpanel & http service just to be safe).

/etc/init.d/mysql stop
/etc/init.d/httpd stop
/etc/init.d/cpanel stop


3) Do the copy:

rsync -av /var/lib/mysql /home/


4) Verify copied folder same size as source with du:

du -sh /var/lib/mysql
du -sh /home/mysql


5) Move /var/lib/mysql to /home/mysql-bak (essentially removing /var/lib/mysql because the folder must not exist when symlink is created)

mkdir /home/mysql-bak
mv /var/lib/mysql /home/mysql-bak/


6) Create symlink:

ln -s /home/mysql /var/lib/mysql

7) Verify the symlink is correct when listing the contents of new symlinked /var/lib/mysql (you can refer to the rsync copy to make sure the paths are the same - they should be)

8) Restart mysql, httpd, cpanel

9) Verify mysql-reliant webpage is loading without issue

10) You should now have freed up space on /var. Verify with 'df -h'
 
Source : http://www.webhostingtalk.com/showthread.php?t=1086919

Friday 6 September 2013

Setting PPoE Internet Speedy pada modem ADSL D-Link DSL-526B

Modem adsl 526B adalah modem adsl untuk akses internet mempunyai 1 port RJ-45,RJ,11
modem berpenampilan kecil tetapi berkemampuan luar biasa. Tapi sayang agak sedikit rewel untuk daerah yang listriknya ga stabil
langkah pertama
untuk menseting atau mengkonfigurasi modem saya akan memasang seperti di bawah ini:
topologinya yaitu
kabel telp(line internet)        —-> lubang konektor rJ-11 (pada modem)
PC                                            —-> lubang konektor RJ-45 (LAN) pada modem
langkah kedua
saya menggunakan pc/komputer jadi, sebaiknya local area network/ pada tcp ipnya harap dibuat dhcp, agar dapat mengenali ip modem(untuk di atas windows xp ipv sebaiknya di aktifkan dhcpnya)
kenapa alasan local area connectionnya di buat dhcp karena supaya ip saya akan menjadi satu group dengan ip modem sehingga dapat melanjutkan ke konfigurasi selanjutnya.
bisanya ip bawaan modem dari pabrik akan bernilai 192.168.0.1 atau 192.168.1.1
===========================================================
default ip modem 192.168.1.1
karena local area connection saya dhcp maka nilai ip saya akan bernila 192.168.1.(1-254)
langkah ketiga
Buka browser kemudian mengetikan di adress 192.168.1.11
Masukan  username dan password
default
username =admin
password  =admin
kemudian muncul gambar dibawah ini

kemudian pilih advanced setup kemudian klik lalu akan muncul tampilah dibawah ini

lalu ikuti gambar lalu klik next

kemudian masukan username yang di dapat dari telkom speedy kemudian diikuti dengan “@telkom.net”
Contoh : 1234567890@telkom.net
Lalu masukan password
Untuk PPoE service name, boleh diisi apa aja
(username dan password speedy diperoleh oleh setiap pelanggan internet speedy)

ikuti gambar kemudian klik next

ikuti gambar lalu klik next

kemudian save
dan konfigurasi selesai, tandanya sudah bisa internet bila anda terkoneksi bilamana pada gambar pertama ada IP speedy anda dan DNS speedy anda ditampilkan.
Jika belum tampil seperti gambar no. 1, cobalah login dulu di website http://www.telkomspeedy.com
Untuk berlangganan kalau internet speedy telp ke 147 , cara itu cara terakhir bilamana masih tidak bisa koneksi internet.

Wednesday 4 September 2013

Change the default MySQL data directory with SELinux enabled

This is a short article that explains how you change the default MySQL data directory and adjust SELinux to account for the changes. The article assumes that you’re running either RHEL, CentOS, Scientific Linux or Fedora with SELinux enabled. This works with the most recent EL (6.2) version.
We’ll be doing this in the following order.
  • Stopping the MySQL server
  • Create a new data directory and move the content from the old data directory
  • Correct the MySQL configuration file
  • Adjust SELinux parameters to accept our new change
  • Starting the MySQL server

Stopping the MySQL server

# service mysqld stop

Create a new data diretory and move the content from the old one

Creating a new data directory

# mkdir /srv/mysql/
# chown mysql:mysql /srv/mysql

Moving the original data files

 # mv /var/lib/mysql/* /srv/mysql/

Correct the MySQL configuration file

Edit the my.cnf file for your distribution. In my example it’s located in the /etc/mysql/ directory. RHEL/CentOS/Scientific Linux put the my.cnf file directly in /etc by default.
# nano /etc/mysql/my.cnf
Change
datadir=/var/lib/mysql
to
datadir=/srv/mysql
and
socket=/var/lib/mysql/mysql.sock
to
socket=/srv/mysql/mysql.sock
and save the file.

Adjust SELinux parameters to accept our new change

Should the following command output “Permissive” or “Disabled” then you may skip the details for SELinux.
# getenforce
Run the semanage command to add a context mapping for /srv/mysql.
# semanage fcontext -a -t mysqld_db_t "/srv/mysql(/.*)?"
Now use the restorecon command to apply this context mapping to the running system.
# restorecon -Rv /srv/mysql

Starting the MySQL server

# service mysqld start

Verifying access and connectivity

$ mysql -u root -p
mysql> show databases;
If this is working, you’re up and running. Should you get a message that says

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
then add the following to your /etc/my.cnf
[client]
socket = /srv/mysql/mysql.sock
Optionally you can just use
$ mysql -u root -p --protocol tcp
to avoid connecting via the socket.

Source : http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled

Web server on centos 6.3

Here is a quick how to guide on setting up a web server on Centos 6.3Run this script…

sudo yum update -y
sudo yum install httpd -y
sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli php-gd mysql -y
sudo yum install mysql-server -y
sudo yum install openssh-clients -y
sudo yum install wget -y
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
 
 
# Once installed you should see some additional repo definitions under the /etc/yum.repos.d directory. #

ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo
 
 
# You should see:
/etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/remi.repo
 
 
# Enable the remi repository #
The remi repository provides a variety of up-to-date packages that are useful or are a requirement for many popular web-based services. That means it generally is not a bad idea to enable the remi repositories by default.
First, open the /etc/yum.repos.d/remi.repo repository file using a text editor of your choice:

sudo vi /etc/yum.repos.d/remi.repo
 
 
# Edit the [remi] portion of the file so that the enabled option is set to 1. This will enable the remi repository.#

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority
 
 
# Install mcrypt #
sudo yum -y install php-mcrypt
 
 
# Add username and password for phpmyadmin #
sudo adduser phpmyadmin
sudo passwd phpmyadmin
 
 
# Allowing HTTP and HTTPS through the firewall #
Run following command:
sudo vi /etc/sysconfig/iptables
Then add these two lines after the entry allowing port 22:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
Then run:
sudo service iptables restart
 
 
# adjusting apache config #
sudo vi /etc/httpd/conf/httpd.conf
 
 
# Scroll all the way down the the bottom of the Config file by pressing G (Shift + g) then press “a” so you can start manipulating the file.

# paste the following 4 lines and adjust the document root and the ip address
DocumentRoot /var/www/html
ServerName 1.2.3.4

# Sroll up until you find #
DirectoryIndex and replace with the following line:
DirectoryIndex index.html index.php index.sh default.jsp


# make sure DocumentRoot is set to
/var/etc/html


# Remove # infront of NameVirtualHost
the press “Esc” and then type ZZ (two capital Z’s)


# Finally, start the Apache server using the command:
sudo service httpd start


# Configuring MySQL #
#run:
sudo service mysqld start
/usr/bin/mysql_secure_installation

# Run through the wizard answering the questions to setup MySQL
# installing phpmyadmin
cd /var/www/html
sudo wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.9.1/phpMyAdmin-3.3.9.1-all-languages.tar.gz
tar -xzvf phpMyAdmin-3.3.9.1-all-languages.tar.gz -C /var/www/html
sudo mv phpMyAdmin-3.3.9.1-all-languages phpmyadmin
sudo rm -rf phpMyAdmin-3.3.9.1-all-languages.tar.gz
cd /var/www/html
sudo chown phpmyadmin.apache phpmyadmin/
cd /var/www/html/phpmyadmin/
sudo mkdir config
sudo chmod o+rw config
sudo cp config.sample.inc.php config/config.inc.php
sudo chmod o+w config/config.inc.php
sudo service httpd restart


# configuring PHPmyadmin #
# edit the phpmyadmin config file by running the following command:
sudo vi /var/www/html/phpmyadmin/config/config.inc.php


# Near the top of the file you will see this line:#
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */


# All you need to do here is enter a random string of characters between the quotation marks. #
# Scroll down to the /* Server Parameters */ section, and change
$cfg['Servers'][$i]['extension'] = ‘mysql’;
to
$cfg['Servers'][$i]['extension'] = ‘mysqli’;


# Scroll down a bit further and you will find the /* User for advanced features */ section. Leave the control user and the control password commented out, as we will not need them, and uncomment all of the other lines starting with $cfg in this section and the one below it. Save your changes by pressing Esc and entering :wp. Change directory back to the phpmyadmin config folder. ###


# Then run the following commands #
cd /var/www/html/phpmyadmin/config
sudo cp config.inc.php ..
cd ..
sudo rm -rf config
 
 
# Then download create_tables.sql
After you have downloaded the file, log in to phpMyAdmin if you aren’t already logged in and go to the import tab. Select the create_tables.sql file from your Downloads directory and click Go. The script will be run and the tables will be created. If the error does not disappear, log out of phpMyAdmin and log back in and it should disappear.


# moving Mysql database to new server #
mysqldump -u username -password databasename > dump.txt

mysql -u username -password databasename < dump.txt


# Setting up NTP Sync#
Run:
sudo yum install ntp -y
sudo /sbin/chkconfig ntpd on
sudo /etc/init.d/ntpd start
If you want to be able to send email from your contact forms please make sure that you are allowed through your firewall and it helps if you are on a static IP address:
setsebool -P httpd_can_sendmail 1
Please leave a comment if this article has helped you! Thanks and enjoy!

Source : http://www.parktec.com/2013/02/web-server-on-centos-6-3/