If you are seeing this in your bash (SSH), It makes it tough to navigate through SSH since it doesn’t give you much information.
-bash-3.2#
To fix that, you can simply type this in your SSH when logged in:
PS1="[\u@\h \W]\$ "
If you are seeing this in your bash (SSH), It makes it tough to navigate through SSH since it doesn’t give you much information.
-bash-3.2#
To fix that, you can simply type this in your SSH when logged in:
PS1="[\u@\h \W]\$ "
I asked my client to buy a Linode for some testing purposes and I tried it for the first time. I must say, Linode is blazzing fast. Downloads are touching 8M/sec and speed, performance is as if its running on a VM on my local system.
Update: Now its been almost a month running Linode and I strongly recommend this VPS company.
Update 2: If you plan to signup for LINODE, use my referral link, it will give you the same price but it will help me a lil http://www.linode.com/?r=587d6a71720a4606811a5710431462642c56bc21
Its been about almost more then two years since I have been playing with CentOS on many different platforms etc. Its very stable but on the other hand, PHP/MySQL updates are very hard to get and still PHP is 5.1.6. I tried EPEL repo and it updated PHP to 5.3.1 but still there were conflicts with stuff and many core packages.
So, I thought why not move to Ubuntu since it has just announced 10.04LTS (Long Term Support) in April 2010. Folks at iWeb were really nice to do a reinstall without any charges and also process a memory upgrade request at an amazing 50% discount.
Ubuntu 10.04 LTS
As a comparison CentOS 5.4 has the following versions
So if you are a PHP developer looking to deploy a Linux flavour on your new box, choose Ubuntu
I just secured a nice deal on QuickWeb.co.nz‘s Texas data center. Thanks to lowendbox for the info on this special coupon. Plan to use it to test new stuff before putting it on my two other production servers (with iWeb.com).
Connect to server via SSH and then issue the following command
sudo passwd
output will be something similar to this
root@vps:~# sudo passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
If you want to install PHP 5.2.x instead of the PHP 5.1.6 offered with default CentOSPlus repo. Please consider installing the utterramblings repo. Setting up this repo is a breeze … just follow these steps
Update: A newer version of this article is available at http://www.centosblog.com/2012/01/16/how-to-install-webmin-on-centos/
Earlier, I posted a how-to to Install Webmin on Ubuntu, now im going through the tutorial again but this time for CentOS.
Install dependancies before we proceed to install webmin
yum -y install perl-Net-SSLeay
Download the latest version of webmin
wget http://downloads.sourceforge.net/project/webadmin/webmin/1.500/webmin-1.500-1.noarch.rpm?use_mirror=ignum
Once it is downloaded, install the RPM using the following command
rpm -i webmin-1.500-1.noarch.rpm
No more steps required. Its installed ![]()
Go to your browser and access the control panel with valid ssh credentials
Last night, I was trying to get a crontab working in CodeIgniter, since my current project (a personal project) is using CodeIgniter now. I didn’t wanted to use the conventional approach of running crontabs and my code seperate.
Unfortunately, CodeIgniter does not have support for Crontabs and I didn’t wanted to user wget in linux crontab to initiate unwanted requests.
I spent some time and came up with a solution. It uses
So enough of the summary and let me show you how its done.
Create a file (e.g. cron.php) in the same place as your index.php and system folder. Here is its code
/**
* @author Asim Zeeshan
* @web http://www.asim.pk/
* @date 13th May, 2009
* @copyright No Copyrights, but please link back in any way
*/
/*
|---------------------------------------------------------------
| CASTING argc AND argv INTO LOCAL VARIABLES
|---------------------------------------------------------------
|
*/
$argc = $_SERVER['argc'];
$argv = $_SERVER['argv'];
// INTERPRETTING INPUT
if ($argc > 1 && isset($argv[1])) {
$_SERVER['PATH_INFO'] = $argv[1];
$_SERVER['REQUEST_URI'] = $argv[1];
} else {
$_SERVER['PATH_INFO'] = '/crons/index';
$_SERVER['REQUEST_URI'] = '/crons/index';
}
/*
|---------------------------------------------------------------
| PHP SCRIPT EXECUTION TIME ('0' means Unlimited)
|---------------------------------------------------------------
|
*/
set_time_limit(0);
require_once('index.php');
/* End of file test.php */
Now, we need a controller e.g. test so the controller code could be something like this. Please note that normally we do not need to output anything from these controllers since they are doing some background work or sending emails but for the sake of giving an example, I will be output-ing something to elaborate the example.
/**
* @author Asim Zeeshan
* @web http://www.asim.pk/
* @date 13th May, 2009
* @copyright No Copyrights, but please link back in any way
*/</code>
class Test extends Controller {
function __construct()
{
parent::Controller();
}
function index()
{
echo "testing from index \n";
}
function test() {
echo "testing from test \n";
}
}
Now execute crontab on linux command prompt
php /full-path-to-cron-file/cron.php /test/index
Voila! all you need now, is to setup the crontab like you normally do.
This code is not shared under any license so feel free to copy/modify/use it. Please link back to this website / post in any way e.g. direct link, credits etc.
P.S. The examples above user PHP5 constructor, If you need to execute this code on PHP4, please modify the constructors.
I wanted to use PARTITIONING introduced in MySQL 5.1 to handle some 2 Million records (and growing everyday) in a table. Ubuntu 8.10 does not have MySQL 5.1 available if you do apt-get the latest version available is 5.0
So this is what I did, its easy and this might help somebody.
nano /etc/apt/sources.list
I prefer nano editor but you can use any editor of your choice. Add these new lines at the end of the end of the file.
deb http://ppa.launchpad.net/monty/ubuntu gutsy main universe restricted multiverse deb http://ppa.launchpad.net/smurf/ubuntu gutsy main universe restricted multiverse
(These packages were targeted for 7.10 so I will recommend using them and removing them from this list once you got the latest MySQL version)
Now run the following commands
apt-get update apt-get upgrade
Note that you may need to do sudo prefix to these commands if you are using a non-root account. Now lets do the one last step, Installing MySQL 5.1
apt-get install mysql-server-5.1
Update: I have got another source to get even latest minor version of MySQL 5.1, just follow the above steps, then start over again and add following lines to “/etc/apt/sources.list” instead of the one above.
deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all
It worked for me on Ubuntu 8.10, im sure it will work for just any server version.
I am not a linux guru so if someone has a better option to upgrade to MySQL 5.1 or the latest version, please let me know.
WARNING: Please use this method to install Apache, PHP and MySQL because its more suitable for most of your needs and has options to auto-upgrade your installation. The following method is obsolete and not recommended.
After trying to install Apache, MySQL and PHP on Ubuntu 8.10 via several methods listed over the web. I opted for xampp package for linux.
It is as easy as ABC
Download the xampp linux package from their official website
wget http://nchc.dl.sourceforge.net/sourceforge/xampp/xampp-linux-1.7.tar.gz
(I have selected NCHC, Taiwan as the mirror to download this package, you may try another)
Extract the files
sudo tar xvfz xampp-linux-1.7.tar.gz -C /opt
Chmod the files to have nobody ownership
sudo chown -R nobody:root /opt/lampp/
Configure xampp security
sudo /opt/lampp/lampp security
Start xampp with this command
sudo /opt/lampp/lampp start
Stop xampp
sudo /opt/lampp/lampp stop
Restart xampp
sudo /opt/lampp/lampp restart
Login to ftp using the username nobody and the password that you have set up in the “xampp security”
To uninstall xampp
sudo rm -fr /opt/lampp
Enjoy!!