This tutorial is meant for people who are want PHP5 on their Ubuntu computer along with Apache2, but can’t seem to make it happen. I’ll just explain it all as it happened to me.

I have an old pc running BackTrack 4 R2 which is used as a MySQL server. It’s Ubuntu version is Intrepid, which isn’t officially supported anymore. As it happened, we needed to run a small webserver on it with PHP support. Although Apache2 is installed and running fine, server wouldn’t handle PHP files and will just offer them as download instead of processing them.
Now the first step is to install PHP.

Now, as I said before, my Ubuntu version is old and not supported, I had to manually change my repository list at /etc/apt/sources.list and add the following lines:Continue reading

I just managed to get BackTrack 5 running on my PC at home after  a lot of struggle.  Installation was pretty smooth as everything from booting up from Live DVD to installation was very easy. But the real problems popped out after that. I originally intended to write one long post listing all the problems faced, but this one will address one only.

 

 startx command doesn’t work

 

This was the most annoying problem which just refused to get fixed.  After logging in on command prompt, you need to run startx command in order to start GUI, but for some folks GUI doesn’t start and it falls back to command prompt with errors like:

VESA(0): no valid modes
Screens found but, no usable configuration.

 

and / or something similar. The problem is particularly vexing because live DVD works just fine.  I had the same problem in GNOME 64 bit and KDE 32 bit versions.  There are quite a few people who faced this problem and it seems like the solutions provided in these pages, Techarena and BackTrack forums do work for many people. But no solution provided in those threads at that time worked for me.  If you are like me and neither of those solutions worked for you, then read on.

There are two ways to do this. First an easier way is to boot using live DVD and connect to internet to download drivers and update. Other is to  log in to BackTrack installation using root account with password toor and access internet from command prompt. You can do it either way, it’s your choice. Please read the following tutorial here to learn how to configure internet connection from command prompt.  From command line, you can use lynx browser, but it’s utility is rather limited. So I suggest booing up from CD and downloading drivers first to a location which you can access from installation.

Once your internet is up and running, check up your repositories and update,

apt-get update 

Don’t run apt-get upgrade yet. It’ll just download and install 500MB worth of software and the problem will come back on next reboot. Also keep in mind that updates have to be installed on hard disk installation. Don’t run this command on live DVD boot Now you have to download and install drivers for your graphics card. Mine is a NVidia and I downloaded my drivers from this page: http://www.nvidia.com/object/unix.html

For 32-Bit, run command

 

wget http://us.download.nvidia.com/XFree86/Linux-x86/290.10/NVIDIA-Linux-x86-290.10.run 

 

For 64 bit,

wget  http://us.download.nvidia.com/XFree86/Linux-x86_64/290.10/NVIDIA-Linux-x86_64-290.10.run

Users with Intel and ATI chipsets  can download their divers from http://www.intel.com/support/graphics/sb/cs-010512.htm and http://support.amd.com/us/gpudownload/Pages/index.aspx . After the downloads are complete, install the divers using  either ./driver-file-name.run or sh driver-file-name.run command. You may have to make the files executable first using chmod +x driver-file-name . Some drivers may come in different packages. Follow the instructions in that case.

Run apt-get -f install to fix any missing dependencies and then run startx. You may want to reboot once before doing that though.  startx will work just fine as intended and will guide you to he BackTrack 5 desktop.

This series of posts will contain a list of some very useful Linux commands that you might need every now and then. This one is  a small tutorial on how to delete files in linux.
 First post on Linux networking here

1. Delete files and directories

rm command

Let us assume you want to delete some files in directory /usr/tmp . You first navigate to directory using command

cd /usr/tmp

Now if you want to delete a particular file use rm as following:

rm filename

or you can run following command from whichever directory you are in.

rm /usr/tmp/filename

But if you want to delete all the files in that directory, use rm as following:

rm *.*

To refine it further, if you want to delete only a few files but leave the rest, you’ll have to use wild-cards. I’ll explain it first using deleting by extension example. Let us assume that you have a collection of zip, mp3 and bin files (with extensions .zip, .mp3 and .bin respectively) and you want to delete only mp3 files, then execute :

rm *.mp3

It’ll delete all mp3 files file leaving all zip and bin files intact. But if you want to delete .bin files too, just add the extension like this:

rm *.mp3 *.bin

In order to delete directories, you have to modify it a little by adding -rf, If you have a directory named DIR which you want to delete, execute

rm -rf DIR

As posted earlier, you can use *.* wildcard to delete everything in the directory including all the sub-directories:

rm -rf *

Similarly you can delete files based upon their names too. Executing

rm a*.mp3

will delete all mp3 files which start with alphabet a, while

rm -rf a*

will delete every file and directory which starts with a

Apart from this, you might come across a scenario where you have to find and delete some type of files from multiple directories / folders. In this case I’m assuming that you need to delete all mp3 files located in various sub-folders inside /usr/tmp/. In such a case use find command

find /usr/tmp/ -type f -iname “mp3″ -delete

or

find /usr/tmp -type f -iname “mp3″ -exec rm -f {} ;

If you replace path /usr/tmp with just a / it’ll find and delete ALL mp3 files on your computer. So be careful

Useful links:

http://www.cyberciti.biz
www.linuxquestions.org

This article is for people trying to get their Linux PC connect to internet or just the local network. Most linux distributions come with automatic DHCP clients and thus need minimal tinkering with configuration. But if you are in a situation where having a simple DHCP client is not working, read on. In this part I’ll write about bare basics only.

First run ifconfig command in console window to check your ip configuration. ifconfg is linux counterpart of Windows ipconfig command. Most likely, the output will look like this:


root@jj:/# ifconfig
eth0 Link encap:Ethernet HWaddr 00:e0:1c:40:07:cf
inet addr:192.168.1.117 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:1cff:fe40:7cf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:90395 errors:0 dropped:0 overruns:0 frame:0
TX packets:68143 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58988739 (58.9 MB) TX bytes:11107421 (11.1 MB)
Interrupt:22 Base address:0x3000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:377 errors:0 dropped:0 overruns:0 frame:0
TX packets:377 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:41747 (41.7 KB) TX bytes:41747 (41.7 KB)

Here eth0 identifies your LAN interface. If you have more than one, it’s shown as eth1, eth2 and so on. Wirelss interfaces are shown as wlan0, wlan1 and so on.

lo is you default local interface which will always have ip 127.0.0.1

In this case, you can see that eth0 is correctly configured with ip 192.168.1.117 and netmask 255.255.255.0

If you are sure that your network has a DHCP server and want to use only that, run the following command:

/etc/init.d/networking restart

Unless you had specified a permanent IP address, the interface on which DHCP client is running will get you an ip like this.

For cases where you don’t have a DHCP server to provide you IP configuration automatically or you just want some other address, say 192.168.1.11 on eth0, type the following command

ifconfig eth0 192.168.1.11 netmask 255.255.255.0

This command will assign ip address 192.168.1.11 with netmask 255.255.255.0 to your default network interface eth0. If you want to assign this ip to another ethernet interface, replace eth0 by that interface’s identifier. For example if you want to assign this ip to your 2nd network card, type:

ifconfig eth1 192.168.1.11 netmask 255.255.255.0

Now, that you’ve assigned an ip, it’s time to provide gateway too. If your gateway address in 192.168.1.1,  type the following command.

route add default gw 192.168.1.1
 

 By now, you should be able to connect to your local network. But in order to browse internet, you still need DNS. In Linux, a file named resolv.conf stored in /etc/ contains address of your DNS server. To manually add DNS entries, open resolv.conf in any text editor and add your DNS ip in separate lines. For example:

nameserver 192.168.1.1
namserver 4.2.2.2

Don’t forget to add nameserver before each DNS ip. Save the file and start browsing.

Following above steps will enable you to  connect to the network for current session. But what if you need to save the settings permanently ? For this you’ll need to edit a file named interfaces. It’s path is /etc/network/interfaces and it’s contents look like this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp


iface eth1 inet dhcp
address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.1

#auto eth2
#iface eth2 inet dhcp

#auto ath0
#iface ath0 inet dhcp

auto wlan0
iface wlan0 inet dhcp

 

Here,  auto eth0 , iface eth0 inet dhcp part shows that DHCP is enabled on eth0 interface.

iface eth1 inet static
 address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.1           

This part is for eth1 and displays it’s static ip address, netmask and gateway in different lines. If you want any of your interfaces to have a static permanent address, modify entry for that interface  just like this with address of your choice. In this case, I have 2 network cards and one wireless lan. eth0  and wlan get their ip from DHCP while eth1 has a static ip. You can either delete entries of interfaces that you don’t have or just put a # before them to disable them.
Also you can disable a network interface by using command

ifconfig eth0 down

To enable it again type:

ifconfig eth0 up 

That’s most of it that’s usually needed in a normal computer. Thanks for reading