Saturday, October 27, 2012

Setting up Debian based Linux to install/compile an application


http://ufoai.org/wiki/index.php/Debian

This is a simple guide on how to prepare your Debian distribution such as Ubuntu to compile an application.

Firstly you need to install a GNU compiler.

sudo apt-get install make gcc g++ git-core

Then you need to install the other development packages that is needed for the applicaiton. This is an example of the development packages installation.

sudo apt-get install \
   libsdl1.2-dev libsdl-ttf2.0-dev libvorbis-dev zlib1g-dev gettext libtheora-dev \
   libjpeg8-dev libpng12-dev libcurl3-dev libsdl-mixer1.2-dev \
   libxml2-dev libopenal-dev p7zip-full libcunit1-dev binutils-dev libxvidcore-dev libmxml-dev


If needed, then u need to install cunit to install the unittest suite.

sudo apt-get install libcunit1-dev

Install other development packages needed by the application.

Compilation time!!!

Now here comes the fun part. Compiling the source code so that it would be a running application. An example of what you must do could be like this.

./configure

This command would enable you to run a script called configure. Configure will set up all the required files etc before the main compiling. In other words, it will prepare a "makefile" before we run the new process.

To compile we will use the command:-

make

"make" is a UNIX utility that reads the "makefile" which has the sequence that the OS has to follow to compile the application.

For additional information on "make" please read the following.

http://linuxdevcenter.com/pub/a/linux/2002/01/31/make_intro.html
http://tldp.org/LDP/LG/current/smith.html
http://www.codecoffee.com/tipsforlinux/articles/27.html
http://linux.die.net/man/1/make
http://linux.about.com/library/cmd/blcmdl1_make.htm


How to install TrueCrypt to Ubuntu


http://unixlab.blogspot.com/2011/01/how-to-install-truecrypt-on-ubuntu-1010.html

Firstly, download the required TrueCrypt installation file for Linux.

Once downloaded, untar or unzip the file with this command.

tar -xzvf truecrypt-7.1a-linux-x86.tar.gz

Only 1 file will be extracted which is the installation file. This is the file which we need to install. This is actually a shell script file. So we need to run this shell script with either :-

1. sh
2. bash

sh truecrypt-7.1a-setup-x86

You can read further on running shell script here http://www.cyberciti.biz/faq/run-execute-sh-shell-script/

Congratulations. TrueCrypt has been installed. Just type "truecrypt" to run it.







Saturday, October 20, 2012

VirtualBox -Cannot Register the Hard Drive Because a Hard Drive with UUID Already Exists

http://www.bradleyschacht.com/virtualbox-cannot-register-the-hard-drive-because-a-hard-drive-with-uuid-already-exists/

This is how you solve the problem of not being able to open an image from VirtualBox. The error should look like this.

Go to the C:\Program Files\Oracle\VirtualBox> directory on the Command Prompt.

Then type the following command. Remember that the path of the image has to be correct. And remember to use the " " also.

Command:
VBoxManage internalcommands sethduuid  "C:\Program Files\Oracle\Windows XP\Windows XP.vmdk"

Your output should look like this.




Monday, October 15, 2012

Monday, October 1, 2012

WINDOWS - create new file using "echo" and copy con

echo

echo echo this is a test > test.bat

OR

echo @echo this is a test > test2.bat

The @echo so that you do not see the command being execute

copy con

copy con test.txt

to exit ^z






Unix/Linux - Navigating the File System

http://www.tutorialspoint.com/unix/unix-file-system.htm

CommandDescription
cat filenameDisplays a filename.
cd dirnameMoves you to the directory identified.
cp file1 file2Copies one file/directory to specified location.
file filenameIdentifies the file type (binary, text, etc).
find filename dirFinds a file/directory.
head filenameShows the beginning of a file.
less filenameBrowses through a file from end or beginning.
ls dirnameShows the contents of the directory specified.
mkdir dirnameCreates the specified directory.
more filenameBrowses through a file from beginning to end.
mv file1 file2Moves the location of or renames a file/directory.
pwdShows the current directory the user is in.
rm filenameRemoves a file.
rmdir dirnameRemoves a directory.
tail filenameShows the end of a file.
touch filenameCreates a blank file or modifies an existing file.s attributes.
whereis filenameShows the location of a file.
which filenameShows the location of a file if it is in your PATH.

Unix/Linux File System


http://www.tutorialspoint.com/unix/unix-file-system.htm


Directory
Description
/
This is the root directory which should contain only the directories needed at the top level of the file structure.
/bin
This is where the executable files are located. They are available to all user.
/dev
These are device drivers.
/etc
Supervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages.
/lib
Contains shared library files and sometimes other kernel-related files.
/boot
Contains files for booting the system.
/home
Contains the home directory for users and other accounts.
/mnt
Used to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively
/proc
Contains all processes marked as a file by process number or other information that is dynamic to the system.
/tmp
Holds temporary files used between system boots
/usr
Used for miscellaneous purposes, or can be used by many users. Includes administrative commands, shared files, library files, and others
/var
Typically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data
/sbin
Contains binary (executable) files, usually for system administration. For example fdisk and ifconfig utlities.
/kernel
Contains kernel files

-->

WINDOWS - view text in command prompt

more abcd.txt

or

type abcd.txt | more

vsftpd - Very Secure FTP Daemon


[root@bordeaux saini]$ cd /var/ftp/
[root@bordeaux ftp]$ mkdir SharedMovies
[root@bordeaux ftp]$ mount --bind /home/saini/Movies/ /var/ftp/SharedMovies/

[root@bordeaux saini]$ chown ftp:ftp Upload
[root@bordeaux saini]$ chmod 777 Upload

[root@bordeaux saini]$ mkdir /var/ftp/Uploads
[root@bordeaux saini]$ mount --bind /home/saini/Upload/ /var/ftp/Uploads/

/etc/vsftpd/vsftpd.conf
anonymous_enable=YES
write_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
dirmessage_enable=YES
dirlist_enable=YES
no_anon_password=YES
file_open_mode=0777
guest_enable=YES

service vsftpd restart

Fedora - SSH



service sshd status
service sshd start

CHMOD


execute = 001 in binary = 1 in octal
write = 010 in binary = 2 in octal
read = 100 in binary = 4 in octal

So where does the 7 come from?

7 in binary = 111 in decimal = read, write, execute

So you get:

read write execute = 111 = 1 + 2 + 4 = 7
read write no execute = 110 = 4 + 2 = 6
read no write execute = 101 = 4 + 1 = 5
read no write no execute = 100 = 4
no read write execute = 011 = 2 + 1 = 3
no read write no execute = 010 = 2
no read no write execute = 001 = 1
no read no write no execute = 000 = 0

FEDORA LINUX - restart




shutdown -r to reboot while shutdown -h halt