Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, October 4, 2008

Installing LAMP on Ubuntu

Installing LAMP. If you want to use apt-get install the LAMP layer,

$ sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

Or you can use one taskseltry command:

$ sudo tasksel install lamp-server

Configuring MySQL. Set password for MySQL. tasksel will ask you for root password during installation.

$ mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('lamepassword');

Creating database and user

mysql> CREATE DATABASE lamedatabase; mysql> GRANT ALL PRIVILEGES ON lamedatabase.* TO 'lameuser'@'localhost' IDENTIFIED BY 'anotherlamepassword'; mysql> FLUSH PRIVILEGES;

Configuring Apache. If you get following error when you start apache2 server,

apache2: Could not determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

you need to add ServerName localhost in apache2 configuration file.

Tuesday, October 9, 2007

Using reset command

Using reset command

After accidentally view a binary file in the command line, i.e., user@ubuntu:~# cat /path/some/file, and the prompt shows scrambled text like this:

You need to type reset to get correctly encoded command line. I haven't figure out how to reset from ssh session. So if you know how please let me know.

Friday, September 14, 2007

Using grep

Finding a text in files

grep -lir 'text' /path/to/dir/or/files

Wednesday, August 22, 2007

Using tar

Uncompressing files

tar xvf file.tar tar zxvf file.gz tar zxf file.tgz tar xjvf file.tar.bz2 gunzip -c file.tar.gz | tar xf - bunzip2 file.bz2
Options:
  • f means file
  • z means use zip/gzip
  • v means verbose
Compressing files
tar cvf /tmp/backup.tar /home/username
  • c means create file