Pages

Tuesday, December 30, 2014

cPanel Mysql root password and update mysql



## To see root password:

cat /root/.my.cnf

## To change root password from WHM

Home --> SQL Services --> MySQL Root Password

give password and Click "Change Password"

## To Update

Home --> Software --> MySQL Upgrade

(carefully read instructions and always backup all databases)

Wednesday, December 24, 2014

Java Home setup or other Environment home setup



+++++++++++++++++++++++++++++++++++
yum install java-*
java -version
 alternatives --config java
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java' >> /etc/bashrc

source /etc/bashrc

vi /etc/bashrc
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/

printenv




centos 7 mariadb to mysql server in vritualmin webmin




 cd /etc/yum.repos.d/
 mv MariaDB.repo MariaDB-old


systemctl stop mariadb.service
  wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  rpm -ivh mysql-community-release-el7-5.noarch.rpm
  yum remove  mariadb-server mariadb
  yum install mysql-server
 /usr/bin/mysql_secure_installation
  service mysql start
  mysql -u root -p

   systemctl disable mariadb
   systemctl enable mysqld



 wget http://software.virtualmin.com/gpl/scripts/install.sh
 chmod +x install.sh
 vi install.sh
  remove mariadb mariadb-server
 ./install.sh

vi /etc/my.cnf
Hash or Off this line
# Recommended in standard MySQL setup
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES


goto https://ipaddress:10000

Click -- webmin ---> Servers----> MySQL Database Server--> Module Config--> Configurable Options to System Configuration-->
Command to start MySQL server---/bin/systemctl start  mysqld.service -->
Command to stop MySQL server--/bin/systemctl stop  mysqld.service-->  Save

Monday, December 15, 2014

Java Home setup or Ohter Environment setup





+++++++++++++++++++++++++++++++++++
yum install java-*
java -version
 alternatives --config java
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java' >> /etc/bashrc

source /etc/bashrc

vi /etc/bashrc
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/



## to see is it working or not
 printenv
ant -v
java -v

=-===================================

Saturday, December 13, 2014

Increase Squirrelmail Phpmyadmin wordpress mailbox upload size


============================

vi /etc/php.ini

; Maximum allowed size for uploaded files.
upload_max_filesize   5M
post_max_size         10M
memory_limit          10M


/etc/init.d/http restart


================================

Thursday, December 11, 2014

PHP mail send by smtp server with script





========================================
============================================

yum install php-pear
or
yum install php-pear-Net-SMTP

pear install Net_SMTP
pear install mail




/sbin/service httpd start
/sbin/service mysqld start


or download by wget....
# cd /tmp
# wget http://download.pear.php.net/package/Mail-1.1.14.tgz
# wget http://download.pear.php.net/package/Net_SMTP-1.2.10.tgz
# http://download.pear.php.net/package/Net_Socket-1.0.8.tgz




=================================
=== script to send mail =========
=================================

vi mail.php

<?php
 require_once "Mail.php";

 $from = "Tayab Sender <xyz@domain.com>";
 $to = "Recipient-Khan <abc@yahoo.com>";
 $subject = "Hi!";
 $body = "Hi,\n\nMy Test Mail";

 $host = "smtp.domain.com";
 $username = "user@domain.com";
 $password = "passwordofuser";

 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);
 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));

 $mail = $smtp->send($to, $headers, $body);

 if (PEAR::isError($mail)) {
   echo("<p>" . $mail->getMessage() . "</p>");
    echo "<br> Test";
  } else {
   echo("<p>Message successfully sent!</p>");
  }
=================
php mail.php
============================
If any TLS error like "lost connection after STARTTLS"
then stop tls from server...

vi /usr/share/pear/Net/SMTP.php
  public function auth($uid, $pwd , $method = '', $tls = true, $authz = '')
to
public function auth($uid, $pwd , $method = '', $tls = false, $authz = '')

--------------------Tayab-Khan--------------

Saturday, December 6, 2014

Linxu Filesystem recovery


Follow a script and choose directory name
and next next ....

find /root/result/

Thursday, December 4, 2014

zpanel installation



#######################################################
http://cpanelwhm.org/ssh/install-zpanel-on-centos-server/172

#######################################################



yum -y update
yum -y remove qpid-cpp-client
wget https://raw.githubusercontent.com/zpanel/installers/master/install/CentOS-6_4/10_1_1.sh
chmod +x 10_1_1.sh
./10_1_1.sh

Here you will be asked, FQDN,
External IP & timezone. Set them accordingly.

zPanel username, password, mysql username & password. (copy them at a safe place).

Now access the IP in the browser, (In my case, it was 1.2.3.4),



###########################################


ISPConfig Version Update



#####################################################
take a full backup or snapshot of full server.
======================================
loging to server....
=======================
cd /tmp
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
tar xvfz ISPConfig-3-stable.tar.gz
cd ispconfig3_install/install
php -q update.php

================================================