Everything can be done easily through the command line
sudo apt-get install apache2
this will install apache server on your system
can be checked by typing
http://localhost in your browser window
if you get a message It Works! then its success
now to install php
type
sudo apt-get install php5 libapache2-mod-php5
and now restart the apache to see if its working
type
sudo /etc/init.d/apache2 restart
now create a file say with the name testphp.php in your www folder(/var/www)
you should open it as root so
type: sudo gedit /var/www/testphp.php
and type
phpinfo();
?>
now if you type http://localhost/testphp.php in your browser you will get the file giving the information on php installed on your system
Once again open up Terminal and then copy/paste this line:
sudo apt-get install mysql-server
(optional). In order for other computers on your network to view the server you have created, you must
first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file.
gksudo gedit /etc/mysql/my.cnf
Change the line
bind-address = 127.0.0.1
And change the 127.0.0.1 to your IP address.
To change the password of the root user
type in terminal, this will take you to the mysql console
mysql -u root
Following that copy/paste this line:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
(Make sure to change yourpassword to a password of your choice.)
To intall phpMyAdmin
To install a program called phpMyAdmin which is an easy tool to edit databases.Copy/paste the following line into Terminal:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file
entitled php.ini. To open it type the following:
gksudo gedit /etc/php5/apache2/php.ini
Now we are going to have to uncomment the following line by taking out the semicolon (;).
Change this line:
;extension=mysql.so
To look like this:
extension=mysql.so
Now just restart Apache and you are all set!
sudo /etc/init.d/apache2 restart
Saturday, October 31, 2009
Split and Join files in liinux
split is the command used to split large files in linux
let us split the file
music.mp3
inorder to split it to 1mb each the following command is used
split -b 1M music.mp3
here this -b refers to splitting files based on bytes, files can be splitted based on lines too it is by giving -l
this will create files named xaa xab xac ........
this can later be combined to a single file called music-combined.mp3 as
cat xa* > music-combined.mp3
more information in this regard can be obtained my refferring to the man file of split
man split
let us split the file
music.mp3
inorder to split it to 1mb each the following command is used
split -b 1M music.mp3
here this -b refers to splitting files based on bytes, files can be splitted based on lines too it is by giving -l
this will create files named xaa xab xac ........
this can later be combined to a single file called music-combined.mp3 as
cat xa* > music-combined.mp3
more information in this regard can be obtained my refferring to the man file of split
man split
Tuesday, October 20, 2009
To read from keyboard - java
use java.io package
import java.io.*;
next you'll need an InputStreamReader to read from the System.in stream
Code:
InputStreamReader isr = new InputStreamReader(System.in) );
afterwards, you'll need a BufferedReader to store the stream
Code:
BufferedReader br = new BufferedReader(isr);
use the readLine() method to get a string
Code:
String sampleString = br.readLine();
put it all together
Code:
import java.io.*;
class RandomClass
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
String sample = br.readLine()
}
import java.io.*;
next you'll need an InputStreamReader to read from the System.in stream
Code:
InputStreamReader isr = new InputStreamReader(System.in) );
afterwards, you'll need a BufferedReader to store the stream
Code:
BufferedReader br = new BufferedReader(isr);
use the readLine() method to get a string
Code:
String sampleString = br.readLine();
put it all together
Code:
import java.io.*;
class RandomClass
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
String sample = br.readLine()
}
Thursday, October 1, 2009
CRONTAB automate your task....
So how many of you have heard of crontab in linux.
Its something which is very useful. It automates tasks....
suppose you want to execute a task at sometime in the future (only if the system is switched on), all you need to do is add the command in the crontab.
in order to install a crontab just type crontab -e
this will open you a file to write commands with some other fields too
m h dom mon dow command
The above given is the order in which you have to make the entry in the cron..
m stands for minute of the hour
h for hour of the day(24 hour clock)
dom stands for the day of the month
mon stands for the month
dow stands for the day of the week
command this is where you specify the command which is to be executed
so as an example
34 6 9 4 * mkdir /home/username/file
the above command makes a directory named file on 9th of April at 6 hours and 34 minutes in the folder /home/username
you can also specify a range too
32-50 * 9 4 * command
the above command is executed on April 9th in every minute from 32-50 minutes in all the 24 mangagers. hours...
---the above post is incomplete, will be updated soon---
Its something which is very useful. It automates tasks....
suppose you want to execute a task at sometime in the future (only if the system is switched on), all you need to do is add the command in the crontab.
in order to install a crontab just type crontab -e
this will open you a file to write commands with some other fields too
m h dom mon dow command
The above given is the order in which you have to make the entry in the cron..
m stands for minute of the hour
h for hour of the day(24 hour clock)
dom stands for the day of the month
mon stands for the month
dow stands for the day of the week
command this is where you specify the command which is to be executed
so as an example
34 6 9 4 * mkdir /home/username/file
the above command makes a directory named file on 9th of April at 6 hours and 34 minutes in the folder /home/username
you can also specify a range too
32-50 * 9 4 * command
the above command is executed on April 9th in every minute from 32-50 minutes in all the 24 mangagers. hours...
---the above post is incomplete, will be updated soon---
Subscribe to:
Posts (Atom)