Thứ Sáu, 21 tháng 10, 2011

Link repo download CentOS

http://mirror-fpt-telecom.fpt.net/centos/5.6/isos/i386/
http://mirror-fpt-telecom.fpt.net/centos/5.5/isos/i386/
http://mirror-fpt-telecom.fpt.net/centos/6.0/isos/i386/

x86_64:
http://vault.centos.org/5.6/os/x86_64/CentOS/

Thứ Hai, 3 tháng 10, 2011

Thứ Bảy, 24 tháng 9, 2011

Fix lỗi thẻ embed trên IE

<!--start_raw-->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("player4", "9.0.0");
</script>
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="365" height="312" id="player4">
<param name="movie" value="player.swf">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="flashvars" value="file=/wp-content/filmMarco.flv">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="player.swf" width="365" height="312">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="flashvars" value="file=/wp-content/filmMarco.flv">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player">
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
<!--end_raw-->

Thứ Ba, 16 tháng 8, 2011

Chú ý khi cài mới UBUNTU

Chỉnh kích thước màn hình: http://www.ubuntugeek.com/how-change-display-resolution-settings-using-xrandr.html
Cài java6-jdk:

Thứ Sáu, 12 tháng 8, 2011

Mở filewall cho NFS


iptables -A INPUT -p tcp --dport nfs -s 10.58.63.190/10.58.63.199 -j ACCEPT
iptables -A INPUT -p udp --dport nfs -s 10.58.63.190/10.58.63.199 -j ACCEPT
iptables -A INPUT -p tcp --dport 111 -s 10.58.63.190/10.58.63.199 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Thứ Ba, 2 tháng 8, 2011

Fix lỗi old authentication MySQL

http://www.bitshop.com/Blogs/tabid/95/EntryId/67/PHP-mysqlnd-cannot-connect-to-MySQL-4-1-using-old-authentication.aspx

Thứ Năm, 21 tháng 7, 2011

Install spawn-fcgi


 rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

 yum install spawn-fcgi
location / {
    try_files $uri $uri/ /index.php?p=$uri&$args;
}

Chủ Nhật, 17 tháng 7, 2011

Cài đặt Mysql bằng RPM


Howto Install MySQL on Linux

by RAMESH NATARAJAN on JULY 6, 2008
MySQL Logo
Most of the Linux distro comes with MySQL.  If you want use MySQL, my recommendation is that you download the latest version of MySQL and install it yourself. Later you can upgrade it to the latest version when it becomes available. In this article, I will explain how to install the latest free community edition of MySQL on Linux platform.

1. Download the latest stable relase of MySQL

Download mySQL from mysql.com .  Please download the community edition of MySQL for your appropriate Linux platform. I downloaded the “Red Hat Enterprise Linux 5 RPM (x86)”. Make sure to download MySQL Server, Client and “Headers and libraries” from the download page.
  • MySQL-client-community-5.1.25-0.rhel5.i386.rpm
  • MySQL-server-community-5.1.25-0.rhel5.i386.rpm
  • MySQL-devel-community-5.1.25-0.rhel5.i386.rpm

2. Remove the existing default MySQL that came with the Linux distro

Do not perform this on an system where the MySQL database is getting used by some application.
[local-host]# rpm -qa | grep -i mysql
mysql-5.0.22-2.1.0.1
mysqlclient10-3.23.58-4.RHEL4.1

[local-host]# rpm -e mysql --nodeps
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[local-host]# rpm -e mysqlclient10

3. Install the downloaded MySQL package

Install the MySQL Server and Client packages as shown below.
[local-host]# rpm -ivh MySQL-server-community-5.1.25-0.rhel5.i386.rpm MySQL-client-community-5.1.25-0.rhel5.i386.rpm
Preparing...                ########################################### [100%]
1:MySQL-client-community ########################################### [ 50%]
2:MySQL-server-community ########################################### [100%]
This will also display the following output and start the MySQL daemon automatically.
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h medica2 password 'new-password'

Alternatively you can run:
/usr/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.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

Starting MySQL.[  OK  ]
Giving mysqld 2 seconds to start
Install the “Header and Libraries” that are part of the MySQL-devel packages.
[local-host]# rpm -ivh MySQL-devel-community-5.1.25-0.rhel5.i386.rpm
Preparing...                ########################################### [100%]
1:MySQL-devel-community  ########################################### [100%]
Note: When I was compiling PHP with MySQL option from source on the Linux system, it failed with the following error. Installing the MySQL-devel-community package fixed this problem in installing PHP from source.
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

4.  Perform post-install security activities on MySQL.

At a bare minimum you should set a password for the root user as shown below:
[local-user]# /usr/bin/mysqladmin -u root password 'My2Secure$Password'
The best option is to run the mysql_secure_installation script that will take care of all the typical security related items on the MySQL as shown below. On a high level this does the following items:
  • Change the root password
  • Remove the anonymous user
  • Disallow root login from remote machines
  • Remove the default sample test database
[local-host]# /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

5.  Verify the MySQL installation:

You can check the MySQL installed version by performing mysql -V as shown below:
[local-host]# mysql -V
mysql  Ver 14.14 Distrib 5.1.25-rc, for redhat-linux-gnu (i686) using readline 5.1
Connect to the MySQL database using the root user and make sure the connection is successfull.
[local-host]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.1.25-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
Follows the steps below to stop and start MySQL
[local-host]# service mysql status
MySQL running (12588)                                      [  OK  ]
[local-host]# service mysql stop
Shutting down MySQL.                                       [  OK  ]
[local-host]# service mysql start
Starting MySQL.                                            [  OK  ]

Thứ Bảy, 16 tháng 7, 2011

MySQL 5.5 and 5.1 on CentOS 5.5


In a couple of days, MySQL 5.1 will move to extended lifecycle support, where only security fixes and the most severe bugs are fixed. MySQL 5.0 has bee like this for a year already. Typically, extended lifecycle will last for two years, after which will become end-of-line, where no support is guaranteed.
CentOS 5.x has been providing MySQL 5.0 in it’s distribution since that was the active stable branch when CentOS 5.0 was released on 12th April 2007 (or more specifically it’s upstream distribution RHEL 5, which was released 14th March 2007). Since then, Sun/Oracle have released MySQL 5.1 and MySQL 5.5, so the Webtatic Yum repository has added them to it’s web stack, which now provides updated versions of all the AMP in LAMP.
This release is different from the previous packages, since it is important to only upgrade MySQL when you are ready, and you may want to chose to follow only 5.1 updates or 5.5 updates. This does mean though that you will have to uninstall your current mysql installation first.
First, to set up the yum repository, install the webtatic-release RPM:
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
MySQL client library is used with several CentOS packages, so to remove MySQL without them, I have a mysql client library which is independent of the client tools, which can be installed first to be used instead.
yum install libmysqlclient15 --enablerepo=webtatic
Then you can uninstall MySQL:
yum remove mysql mysql-*
Then install the new MySQL version (either mysql51 or mysql55 can be installed here):
yum install mysql55 mysql55-server --enablerepo=webtatic
You should upgrade existing tables before setting the server to become a production machine, which can be done by starting the server and running the mysql_upgrade script (this may take time depending on the size of the database).
service mysqld start
mysql_upgrade

Thứ Bảy, 9 tháng 7, 2011

Các lệnh Linux hay ho

  • ps -aefL | grep java | wc -l
  • netstat -lpn | grep ":9000" => Xem tiến trình nào chạy port 9000
  • df: xem dung lượng ổ đĩa cứng
  • du -ah : xem dung lượng 1 thư mục
  • Xem thông tin CPU và Ram: cat /proc/cpuinfo & cat /proc/meminfo
  • Đếm số lượng file trong folder: ls -l . | egrep -c '^-'
  • export PATH=$PATH:/usr/local/php/bin/ : set bien moi truong cho php
  • SHOW GLOBAL STATUS;
  • Clear all memory echo 3 > /proc/sys/vm/drop_caches
  • tcpdump -i <interface> -s 65535 -w <some-file>
  • ps -eLF | grep ProcessDeductFee
  • ip a | grep -e inet.*em4 #check card mang
  • ldconfig -p | grep libjpeg #check lib exist of not
  • xrandr --newmode "1600x900_75.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync xrandr --addmode VGA1 1280x1024_60.00
  • sudo openvpn --config ~/openvpn/client.ovpn
  • vlc -vvv udp://@224.0.0.1:8100 --sout='#std{access=file,mux=ts,dst=file_8100.mp4}'
  • traceroute IP -T -p Port  check port
  • :set fileformat=unix :chuyen ve format Linux, bo cac ki tu thua cua DOS
    lsof /path/to/file: xác định tiến trình đang đọc ghi file  
  • grep -rnw '/path/to/somewhere/' -e "pattern"
    curl -L -O -C - url #download with resume
    

Thứ Tư, 22 tháng 6, 2011

Reposistory PHP 5.3

PHP 5.3 on CentOS 5.5

I have compiled the latest PHP version, 5.3.6, and put it in the Webtatic repository for easy installation. I have compiled it for CentOS 5 i386 and x86_64, and provided the source RPMS in the repo, if anyone wants to compile it for another OS or architecture.
Update 2009-07-03 – I updated the version to PHP 5.3, which was released a few days before. This includes many new features such as closures, namespaces, and packaged scripts in phar files, which I’ll blog about soon. Check out PHP changelog for more details.
Update 2009-09-01 – Added a note about deprecated errors, and how to silence them. Also I have included a tip that might help those of you struggling to install.
Update 2010-03-03 – I’ve added both apc 3.1.3p1 beta (php-pecl-apc in yum) and eAccelerator 0.9.6 (php-eaccelerator in yum) RPMs to the repository, they are compiled for (and work on) php 5.3.x
I have also included the same php extensions I mentioned in my other article, php-mcrypt, php-mhash (in PHP 5.2), php-mssql and php-tidy
To install, first you must tell rpm to accept rpm’s signed by me, then add the yum repository information to yum:
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
Now you can install php by doing:
yum --enablerepo=webtatic install php
Or update an existing installation of php, which will also update all of the other php modules installed:
yum --enablerepo=webtatic update php

Packages

PackageProvides
phpmod_php
php-bcmath
php-cliphp-cgi, php-pcntl, php-readline
php-commonphp-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php-dba
php-devel
php-eaccelerator
php-embeddedphp-embedded-devel
php-fpm
php-gd
php-imap
php-intl
php-ldap
php-mbstring
php-mcrypt
php-pecl-apc
php-pecl-memcache
php-pecl-xdebug
php-mssqlphp-pdo_dblib
php-mysqlphp-mysqli, php-pdo_mysql, php_database
php-odbcphp-pdo_odbc, php_database
php-pdo
php-pgsqlphp-pdo_pgsql, php_database
php-processphp-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php-pspell
php-recode
php-snmp
php-soap
php-suhosin
php-tidy
php-xmlphp-dom, php-domxml, php-wddx, php-xsl
php-xmlrpc
php-zts

“Depsolving” problems

If you get depsolving problems when updating, you may have currently installed some extensions that have been removed, e.g. php-mhash, php-ncurses.
You will need to remove them before upgrading.
yum remove php-mhash php-ncurses

Timezone Errors

If you have not set the default timezone for dates, you will get PHP warnings and in some cases fatal errors (e.g. when using the DateTime object). PHP will by default use the system’s timezone if not a fatal error, however either in your application or the php.ini, you should set the setting date.timezone. It’s more ideally set in the application, which should be aware of it’s own timezone setting.

Deprecated Errors

Once you are running the new version, you may get “deprecated” errors in your error logs. This isn’t bad, it just means to tell you that some of the functions you are using are no longer prefered, and may be removed in a future major release. An example of this is the ereg functions. Preg functions are prefered over these, as they are much faster and more powerful, and in all cases do at least the same thing.
If upgrading the functions are not an option, and you would like to hide the deprecated errors from your error log, for example on a production server, just edit your /etc/php.ini file, find the line:
error_reporting  =  E_ALL
and replace to:
error_reporting  =  E_ALL & ~E_DEPRECATED

PHP 5.2.17

I am also maintaining a PHP 5.2.17 release, so should you prefer to install that (for reasons like incompatibilities or testing), you can force it to install that instead by doing:
yum --enablerepo=webtatic --exclude=php*5.3* update php
Or you can add to the /etc/yum.repos.d/webtatic.repo the line:
exclude=php*5.3*