Programming in and with Xubuntu.

Python Installation

Ubuntu makes starting easy, as it comes with a command line version pre-installed. You can begin the process with either the command line version or the graphical Interactive Development Environment (IDLE).

Python Programming From the Command Line

Open a terminal window and type ‘python’ (without the quotes). This opens python in interactive mode.

While this mode is good for initial learning,  use a text editor (like Gedit, Vim or Emacs) to write your code. As long as you save it with the .py extension, it can be executed in the terminal window.

To run a script from the command line, type: python my_script.py. To exit the command line, type exit() or hit ctrl+d

Python Programming with IDLE

Can’t imagine writing a long program from the command line? Me either. In that case, you can try IDLE. Open a terminal window and type: ‘idle’. (without the quotes). You’ll see the python graphical shell loaded.

To write a Python script, click on File > New Window. This will open a sort of Notepad type editor. Type in the following code:

#linuxversion.py

#Have user input version and print response

greeting = raw_input(“Jambo”)

print “Hello world in swahili:”, name, ” – Linux rules!”

Couple things going on here. The first 2 lines, preceded by the # sign are just comments.

The third statement uses the input gathered from the raw_input function and assigns it to a variable, greeting. Finally, the print statement will return the result.

Save the file, with a .py extension, then click on Run > Run Module from the menu to run the program.

RUBY ON RAILS

1. Log in and open a terminal if you need to. First we’ll install Ruby 1.8 and Ruby’s development libraries. We’ll also install IRB, which is quite useful while trying Ruby programming.

sudo apt-get install ruby-full

You will be prompted for your password so be sure to get it right!

2. Now that Ruby’s installed, run this example code

$ ruby
print ("Mita kuulu!n")
ctrl-D
Mita kuulu! 

JAVA
$ sudo apt-get install sun-java6-jdk   # on Ubuntu 7.10
$ javac HelloWorld.java   # filename must match class name
$ java HelloWorld    # must not write .class here



Categories: Uncategorized | Leave a comment

SSH (Secure Shell )

Login to computer using SSH.

The ssh commands are only relevant if you have an existing account on the PC you want to connect to and if a SSH server is installed.

When using Xubuntu the syntax is quite simple as the client part is already set.

Type the following command in the terminal (interface):

ssh login:$ ssh xubuntu@localhost or the pc I want to get connected to

If the client accepts the connection, you will immediately be prompted to enter the password
Adding a new user (adduser) and use that to log in using SSH.

xubuntu@xubuntu:~$ sudo adduser newUser

Adding user `newUser’ … Adding new group `newUser’ (1000) …

Adding new user `newUser’ (1000) with group `newUser’ … Creating home directory `/home/newUser’ … Copying files from `/etc/skel’ …

Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

Changing the user information for ‘newUser’ Enter the new value, or press ENTER for the

default Full Name []: newUser

Room Number []: 45

Work Phone []: 123-455

Home Phone []: 2324-21212

Other []: Is the information correct? [Y/n] y

xubuntu@xubuntu:~$ ssh newUser@localhost

newUser@localhost’s password: Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-52-generic i686)
Publish a web page as the new user, while connected trough ssh

Using this connection I create the www-directory public_html in the test1′s home directory and under it create index.html with some text. I test opening newUser@xubuntu and it works. As I’ve previously configured Apache to give www-privileges to my users, I know it would work from another computer also, although I don’t have one on the network to try it out at this time.

  • public key / asymmetric encryption
    • An algorithm of encryption in which one key (encrypting key) is public while the other one (decrypting key) is private. By combining these two keys, the data is encrypted and can be only decrypted when the private key is known (in addition to the public one).
  • symmetric encryption
    • In symmetric encryption algorithms, the same (private) cryptographic key is used for both decrypting and encrypting.
  • man-in-the-middle
    • A form of attacking computer security (for example in attempt to decrypt messages) by the attacker being in between of the connection of the victims without them knowing, relaying the victims’ messages to each other, thus capturing the entire conversation.
  • two-way authentication
    • …or mutual authentication. A method of authentication in which both participants in the connection independently authenticate themselves to the other participant, assuring each others’ identity.
  • strong encryption
    • Pretty self-explanatory, strong encryption is a form of cryptography which is considered highly resistant to cracking by analyzing the encrypted message or the encryption method itself, as well as brute force guessing of keys etc.
  • network address translation (NAT)
    • A method implemented by routers to route network traffic, for example from a public IP address to a local network “hiding behind the NAT”. It’s usually used as a way to show only one or a few IP addresses to the public Internet side, while there are multiple computers behind the NAT in private network, each of them having their own local network IP.NAT can also implement port forwarding or other methods of network routing instead or in addition to IP routing.

Sources: https://help.ubuntu.com/

http://www.terokarvinen

Categories: Uncategorized | Leave a comment

Install Apache and create an HTML5 user homepage. Install a database server and create a table.

Install Apache and create an HTML5 user homepage. Install a database server and create a table.

Xubuntu 13.10

Step 1 Installing Apache2

 

The very first thing to do is always to update the package list with the command $ sudo apt-get update.

After that I installed apache2 and I used the command line $ sudo apt-get install apache2. (I knew what I needed to install, but when you don’t know the exact name you can use the search command: $ apt-cache search . e.g. $ apt-cache search web server ).

 

After the installation was completed I checked if it worked by going to the web browser and typed local host in the address bar. The page appeared  that it worked!

 

Step 2 Creating a homepage for the user

 

Firstly I found out the user that I will create the page for. I used the command $ whoami. The user is: xubuntu. Then I tested it in the web browser by typing localhost/~xubuntu, this page appeared:

notfound

To get more information about this error you can browse the logs by inserting the command:  $ tail /var/log/apache2/error.log

To get a working webpage we need to modify the system settings, it is done order to get the permission to create the directory. 2 steps is needed for that. 1) command line : $ sudo a2enmod userdir and 2) for restarting the service we need to use the command:  $ sudo service apache2 restart.

Now is possible to make the directory for the user. For this the command $ mkdir public_html is used. After that the homepage was created for the user and now is possible to publish pages.

public

I created fast a page for the user by creating a simple text file under the public_html directory. This is done by used with the command  $ nano page.html.

The content I added:

And the page in the web browser:

The page.html page:

 

 

Installing a database server (MySQL)

Installing it is as straightforward as installing Apache, but its management is a whole different thing, so in this tutorial we’re just going to do the installing and try it out a bit by creating a table to see if it works. While we’re at it, let’s install phpmyadmin as well in case we want to graphically manage SQL tables.

 

So, here we go again:

1) “sudo apt-get install mysql-server phpmyadmin“

2) Select your passwords as the installer asks them.

3) Now the most difficult task: in this screen:

mysqlinst

Choose the Apache option with space. It’s not chosen by default!

You can move around the typing/choosing spaces with TAB.

4) When asked, give the master database user password you were asked first to get MySQL associated access to Apache

5) DONE!

 

Now you can run the MySQL server client interface by starting MySQL with MySQL root privileges “mysql -u root -p” and begin giving in MySQL commands.

I’ll try and create a database and a table to see if it’s working by typing:

“create database justtesting;”

“use justtesting;”

“create table justatable (justatable int);”

 

 

Categories: Uncategorized | Leave a comment

Installing command line interface software using apt-get. Causing logs and Analyzing the lines.

Installing command line interface software using apt-get.

Cause logs:  (one about success, one about failure or denial).

Analyze these lines.

The computer I am using ASUS Windows 7 Ultimate 64-bit.  The processor is a Intel Core i7 2,40GHz.

 

Installing the software

 

Run 13.10 version xUbuntu  from Live-CD. Opened the Terminal Emulator. (Menu -> Accessories -> Terminal Emulator).

 

Step 1: Updating the list of available packages

 

I used the command: $ sudo apt-get update. This command is used to re synchronize the package index files from their sources via Internet.

Step 2: Searching for the needed software

We needed to install 3 software with a purpose. I decided to install software’s: for instant messaging, a photo management program and CD/DVD burner software.  The command I used was $ apt-cache search.

The search commands I used for my 3 programs:

$ apt-cache search instant messaging

$ apt-cache search manage photo ( I tried photo management but it didn’t show any results)

$ apt-cache search DVD burner

Then there was a long list of different software’s available. To read more about some program I used the command:  $ apt-cache show [name of the software].

 

I choose to look up the description for these software:

 

$ apt-cache show emesene

$ apt-cache show flphoto

$ apt-cache show xfburn

Example of the show command:

Terminal – xubuntu@xubuntu- ~_001

 

Step 3: Installing the software

To install the software, you need to use the command  $ sudo apt-get install [name of the software]. The software is now installed. Note! To not interrupt the installation !

I choose to install: emesene, flphoto and xfburn

 

Example of installation

Terminal – xubuntu@xubuntu- ~_004

 

Step 4: Run the installed software

After I installed my three programs. I tried to find them from the system. To run the program in the background I used the command $ [program  name] &, for example :  $ emesene &

 

Step 5: Inspect the log

 

We needed to  analyze 1-3 lines of log of your choosing. To inspect the activities you can use the command: $ ls  /var/log , it lists all the directories in that. Next I used $ grep sudo /var/log/auth.log it contains system authorization information, including user logins and authentication machinsm that were used.

Terminal – xubuntu@xubuntu- ~_007

Terminal – xubuntu@xubuntu- ~_010

Feb 26 18:01:39 xubuntu sudo: xubuntu : TTY=pts/3 ; PWD=/home/xubuntu ; USER=root ; COMMAND=/usr/bin/apt-get update

This line shows that the root user inserted the command apt-get update at 18:01:39

Feb 26 18:11:10 xubuntu sudo: xubuntu : TTY=pts/1 ; PWD=/home/xubuntu : USER=root ; COMMAND/usr/bin/apt-get install emesene

 

This line shows that the root user used the command apt-get install emesene at 18:11:10 to install a software

 

Feb 26 18:21:02 xubuntu sudo: xubuntu : TTY=pts/1 ; PWD=/home/xubuntu ; USER=root ; COMMAND=/usr/bin/tail -f auth.log

 

This line shows that the root user used the command tail-f auth.log (what is used If you want to view the content of the log files real time, as the application is writing to it. Also it is possible to view multiple log files at the same time.

 

TTY (TeleTYpewriter ) ports are direct connections to the computer such as a keyboard/mouse or a serial connection to the device. PTS (Pseudo Terminal Slave) connections are SSH connections or telnet connections. All of these connections can connect to a shell which will allow you to issue commands to the computer.

 

 

Categories: Uncategorized | Leave a comment

Linux software packages.

In the course of my studies i discovered Linux has some of the best, free of charge and bug free softwares or cheapest for that matter. Its quite easy to download and install software packages using the Ubuntu software center from the main menu.

Image

 

On the left side of the software center GUI console. Browse the categories of the package you are interested in a particular software use the search function on the top right hand side to type the name and search.

Some packages are sold at reasonable fee while majority of them are free.

Click on the package of interest and on the right side click on install button.

The installation progress bar is on top of the install command button and on completion it indicates the application has been installed.

Back to the Ubuntu desktop menu click on the category that the downloaded application fall and click to open or run the application.

Some applications require some settings to be made so be sure on what needs to be done.

I managed to install some application as per below.

Image

Image

Just for demo and documentation purposes.

The best part about Xubuntu software installation and management is you don’t need to download and install which saves you disk space and time and the unlimited free software’s.

I hope you find this helpful as you begin to use Linux.

Categories: Uncategorized | Tags: , | Leave a comment

Information System Development Project “Eventler”

My most successful group project so far as the project manager.

Kindly follow the link to the details of the project.

http://jeetjatton6267.wix.com/eventler#

Categories: Uncategorized | Tags: | Leave a comment

Creating/Burning a Linux live CD.

This is my second attempt at this course after the first one failed due to IT unrelated issues.

It has worked quite easily and successfully following the instructions in class and on http://terokarvinen.com/2014/agenda-for-linux-basics-dat8tf063-23-spring-2014.

PROCEDURE

1. Click on the given link below to download the xubuntu iso image.
http://se.archive.ubuntu.com/mirror/cdimage.ubuntu.com/xubuntu/releases/12.04/release/xubuntu-12.04.3-desktop-amd64.iso.

NB: I tried this on a school computer since i dont have my own PC so i dint have to take back-ups.

2. Open the downloads folder to view the iso image file.

3. Double click to open the file which will prompt you to insert a blank re-writtable CD or DVD on the windows disc image burner.

4. Insert the CD as prompted or USB stick depending on your choice and select burn.

5. After completion the Linux live CD is ready to try live or full installation

Enjoy Using or trying Linux.

Categories: Uncategorized | Leave a comment

Blog at WordPress.com.