Ubuntutorial

howtutorials linux

Archive for December, 2008

Ubucleaner – Simple bash script to keep Ubuntu System Clean

Posted by geekubuntu on December 24, 2008

Note:- This is Only for advanced Ubuntu users

Ubucleaner Features:

– Clean apt cache

– Remove config files left from uninstalled .deb packages(it happens if you don’t use the –purge switch with apt-get)

– Remove every kernel except the one you are using

– Empty the trashes of every user(including root)

It uses apt and the kernel removing thing searches for ubuntu-only packages, so it can’t work on non-debian system and the result is undetermined for other debian-based system, but you can still use the other features of the script(you’ll just have to comment the parts you don’t want).

The script assumes that you are using the text-based Aptitude application, rather than apt-get and dpkg. If you are not using Aptitude, you should also replace the reference to aptitude clean with apt-get clean and the reference to aptitude purge to dpkg -purge.This can be done done by editing the following script.

First you need to download the script from here or using the following command

wget http://www.opendesktop.org/CONTENT/content-files/71529-ubucleaner.sh

Now you should have 71529-ubucleaner.sh file you need to give execute permissions using the following command

sudo chmod +x 71529-ubucleaner.sh

Run the script using the following command

./71529-ubucleaner.sh
Advertisements

Posted in Utilities | Tagged: , , | Leave a Comment »

Security Issue on January 2009

Posted by geekubuntu on December 16, 2008

It’s a battle as old as time: good vs. evil. Fortunately, Linux and FOSS are on our side as we wage the battle against those who try to steal our secrets and invade our systems. Checking your system’s security is best done sooner rather than later. Test the locks with our article on security verification; find out how to use PAM to help secure your systems; use MinorFS and AppArmor to implement discretionary access control; learn more about Samba security in part III of our series; use Darknet to help detect bots and secure your systems; use the Yubikey to increase your site’s security; and don’t forget to lock the doors, because a cold boot attack could render your security useless if somebody has physical access to your computer. But, we’re not just about sowing the seeds of fear. We also show you how to use memcached in Rails, how to manage multiple servers efficiently, how to deploy applications easily with Capistrano, how to manage your videos with MythVideo, how to mix it up a bit (your audio that is), and even play a few games.

Posted in Journals | Tagged: , , | Leave a Comment »

Install a LAMPP server and Joomla in localhost

Posted by geekubuntu on December 16, 2008

Firstly, type the following command at the console:

sudo apt-get update

This will retrieve new lists of packages.

1.Install MySQL5 in Ubuntu

sudo apt-get install mysql-server-5.1

2.Install PHP MyAdmin

sudo apt-get install phpmyadmin

3.Install Apache2 in Ubuntu

sudo apt-get install apache2

This will complete the installation.

After installation Type the server’s IP address (or alias if you added the server to your /etc/hosts file) in your browser’s address bar or, if you are browsing on the server itself, type 127.0.0.1 or localhost. If an error occurs, then you will have to edit the apache2.conf file to ensure that Apache can fully resolve the server’s name.If you have any problem then you have to edit the apache2 configuration file using the following command

sudo nano /etc/apache2/apache2.conf

Add the following type, at the lowers line

ServerName localhost

or

ServerName yourserverip

Include /etc/phpmyadmin/apache.conf

Save and exit, now you need to  restart Apache server using the following command.

sudo apache2ctl restart

4.Change default document root in Apache2

The main configuration file located at /etc/apache2/apche2.conf.If you want to change the default document root you need to edit the /etc/apache2/sites-available/default file and look for this line “DocumentRoot /var/www/” here you can change where ever you want to change.For example if you want to change /home/www the above line looks like this “DocumentRoot /home/www/”.

Save and exit the file

Now you need to  restart Apache server using the following command.

sudo apache2ctl restart

5.Enable PHP support for apache2 webserver

If you want to enable php5  support to your apache webserver use the following commands to install require packages

sudo apt-get install php5 libapache2-mod-php5

You also make sure the php5 modules are enabled using the following commands

sudo a2enmod php5

After installing php support you need to restart apache webserver using the following command

sudo apache2ctl restart

6.Test your PHP Support foe apache webserver

To check the status of your PHP installation

sudo nano /var/www/testphp.php

and insert the following line

<?php phpinfo(); ?>

Save and exit the file

Now open web browser at http://yourserveripaddress/testphp.php and check.

7.Enable CGI and perl support for apache2 server

You need to install the following package

sudo apt-get install libapache2-mod-perl2

8.Configure a cgi-bin directory

You need to create a cgi-bin directory using the following command

sudo mkdir /home/www/cgi-bin

Configuring Apache to allow CGI program execution is pretty easy. Create a directory to be used for CGI programs and add the following to the site configuration file (again between the <VirtualHost> tags).

ScriptAlias /cgi-bin/ /home/www/cgi-bin/

<Directory /home/www/cgi-bin/>

Options ExecCGI

AddHandler cgi-script cgi pl

</Directory>

The first line creates an alias that points to the directory in which CGI scripts are stored. The final line tells Apache that only files that end with the *.cgi and *.pl extensions should be considered CGI programs and executed.

9.Test your Perl Program

cd /home/www/cgi-bin
sudo nano perltest.pl

Copy and paste the following section save and exit the file.

###Start###

#!/usr/bin/perl -w

print “Content-type: text/html\r\n\r\n”;

print “Hello there!<br />\nJust testing .<br />\n”;

for ($i=0; $i<10; $i++)

{

print $i.”<br />”;

}

###End###

make sure you change permissions on it

sudo chmod a+x perltest.pl

Now open your web browser open http://yourserverip/cgi-bin/perltest.pl.It should be working.

10.Installing Joomla in ubuntu

Set a mysql-root password (not the same as a root password, but a password for mysql)

Type the following command at the console:

mysql -u root

then type:

mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘yourpassword’);

mysql> SET PASSWORD FOR ‘root’@’yourhostname’ = PASSWORD(‘yourpassword’);

Where you should change ‘yourhostname’ in last line. Each successful mysql command will show:

Query OK, 0 rows affected (0.00 sec)

Quit the mysql prompt:

mysql> \q

You should now have a functional LAMP stack and a password for the mysql root user.

Visit Apache PHP MySQL for more information on LAMP.

Get the most recent version of Joomla!

Download it from [http://joomlacode.org/gf/download/frsrelease/111/264/Joomla_1.0.12-Stable-Full_Package.tar.bz2] here.

Put on the Desktop

You need to create a joomla directory using the following command:

on root@ubuntu:/var/www#

mkdir joomla

Unpack it

on root@ubuntu:/home/ubuntu/Desktop#

tar -xzvf Joomla_1.0.12-Stable-Full_Package.tar.bz2 -C /var/www/joomla

And then:

on root@ubuntu:/var/www#

chmod 777 -R joomla

Handle ownership (choose one option):

# 1. Allow writting in whole joomla subtree

sudo chown -R www-data:www-data /var/www/joomla

# 2. Allow writting only in places Joomla! needs to write to (more secure)

sudo chown -R root:root /var/www/joomla

Then type:

cd /var/www/joomla

PLACES=’

administrator/backups

administrator/components

administrator/modules

administrator/templates

cache

components

images

images/banners

images/stories

language

mambots

mambots/content

mambots/editors

mambots/editors-xtd

mambots/search

media

modules

templates

for i in $PLACES; do

sudo chown -R www-data:www-data $i

done

Handle file and directory permissions:

cd /var/www/joomla

sudo find . -type f -exec chmod 644 {} \;

sudo find . -type d -exec chmod 755 {} \;

Joomla needs a database, user and password

You need to create a database. You can do this with PhpMyAdmin or via the command line:

mysqladmin -u root -p create joomla

Where joomla is the name you picked for the mysql database that joomla will use. You can call it anything you want.

mysql -u root -pmysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON joomla.* TO ‘yourusername’@’localhost’ IDENTIFIED BY ‘yourpassword’;

You do not want to have Joomla use the mysql root user to access the database. The above command creates a mysql user (other than the mysql root user) with some priviledges to use the joomla database. You will need to chose the yourusername and yourpassword. If the command was successful, activate the new permissions:

mysql> FLUSH PRIVILEGES;

Quit the mysql prompt:

mysql> \q

Reload Apache2

You may need to force-reload apache2 so that it knows to use the php module if you haven’t done so since you installed the LAMP stack.

sudo /etc/init.d/apache2 restart

Finish installation

Point your browser to localhost/joomla, and follow the onscreen instructions.

Posted in Tutorials | Tagged: , , , , , | 8 Comments »

HOWTO: convert .flv to .mpg using ffmpeg

Posted by geekubuntu on December 12, 2008


First, you have to make sure you have ffmpeg installed, if you don’t, then install it from the repositories.

Then:
1. Save a .flv file to a folder (your home folder is fine). I’m going to assume you know how to do this.
2. Open a terminal window and navigate to the folder where you saved the .flv.
3. Type this in the terminal window and hit enter:
Code:

 ffmpeg -i myvideo.flv -ab 56 -ar 22050 -b 500  -s 320x240 myvideo.mpg

myvideo.flv is the file you want to convert, so the name must be the same as the source file. You can name myvideo.mpg whatever you want as long as it has the .mpg extension.

Here’s an explanation of the options used here:
-b bitrate: set the video bitrate in kbit/s (default = 200 kb/s)
-ab bitrate: set the audio bitrate in kbit/s (default = 64)
-ar sample rate: set the audio samplerate in Hz (default = 44100 Hz)
-s size: set frame size. The format is WxH (default 160×128 )

If you need help, type man ffmpeg.

Posted in Tutorials | Tagged: , | Leave a Comment »