Monday, October 19, 2015

Mooshak – Installation on Ubuntu / Linux ( Fully Tested )

How to install Mooshak in Ubuntu / Linux

Mooshak is an online judge for managing programming contests on the Web/online.
It can be extended for new types of contests. Ya you can also customize mooshak for new programming languages.

But Mooshak installation is not that easy. There are so many problems with the installation of mooshak. So in this post I will try to go Step-by-Step to install mooshak on your system .

Note : This installation guide is for Ubuntu / linux platform works similar to Ubuntu only.

Step 1      :     Install Apache & TCL ( Requirements of Mooshak )

 

$ sudo su
$ sudo apt-get install apache2 apache2-suexec
$ sudo apt-get install tcl xsltproc lpr rsync gcc libxml2-utils

Step 2     :     Enable some modules of Apache.

 

$  a2enmod userdir
$  a2enmod suexec

If everything is okay skip to step 2 else if after command 2 ( $  a2enmod suexec ) you get something like this
ERROR: Config file suexec.conf not properly enabled: /etc/apache2/mods-enabled/suexec.conf is a real file, not touching it
then follow this :
Turns out files shouldn't be stored in mods-enabled, they should rather be stored in mods-available. A symlink should then be created in mods-enabled pointing to the file stored in mods-available.

1. First remove the original:

$ mv /etc/apache2/mods-enabled/
suexec.conf /etc/apache2/mods-available/

2. Then create the symbolic link:
$ ln -s /etc/apache2/mods-available/
suexec.conf /etc/apache2/mods-enabled/suexec.conf
 

Step 3     :     Download Mooshak : Click Here

 

Go to Directory where Mooshak is downloaded and extract it.

tar -xzvf mooshak-1.5.2.tgz
cd mooshak-1.5.2

Step 4     :     Copy Required files to required places

 

tar xvf source.tgz
cd lib/apache/
sudo cp 67* /etc/apache2/mods-enabled/userdir.conf
sudo cp 69* /etc/apache2/mods-enabled/suexec.conf
sudo cp /etc/apache2/mods-enabled/userdir.conf /etc/apache2/mods-available/userdir.conf
sudo cp /etc/apache2/mods-enabled/suexec.conf /etc/apache2/mods-available/suexec.conf

Step 5     :     Make some changes to your configuration file of apache, i.e., htttpd.conf

 

You need to add the following lines

Options +ExecCGI

Step 6     :     Edit the install script

 

Now you need to edit the install script. Now change the following line (line 151/153, probably)
set fd [ open "| lsof" ]
to
set fd [ open "| /usr/bin/lsof" ]

Step 7     :     Install

 

$ cd mooshak-1.5.2
$ sudo su
$ ./install --config-suexec
$ ./install

Step 8     :     Restart Apache Services

$ service apache2 restart


voila you are done.
Now either use http://127.0.0.1/~mooshak or localhost/~mooshak to run Mooshak


Step 9    :     Login

 

Choose any contest 

Default User : admin

Default Password : admin

Friday, June 5, 2015

Install Linux Without Physical Media With PXE

Install Linux Without Physical Media With PXE

Install Linux Without Physical Media With PXE

(If you have an existing DHCP server (CENTOs) and you can configure that use this  )


Recently I picked up an older DellPoweredge 2650 server from Craigslist for $50. Even with the age of the device, I couldn’t turn down such a steal. Loaded with two single core 32bit Xeons, a whopping 2GB of RAM, and a few SCSI drives this 2U server was the perfect development server. There was just one issue, it didn’t have an operating system on it. “Ok, not a problem”, I thought “I’ll just put CentOS 7 on a USB stick and install it”. Only to discover that this server doesn’t support USB booting and that RHEL dropped support for 32bit CPUs. Being that this server only has a CD drive, and I don’t have any CD-R/RWs lying around, a PXE install was the only choice for me. In this tutorial, I will show you how to set up a PXE server on CentOS 7.


Ingredients

For this you’re going to need a computer running CentOS 7 (or similar) that will act as the DHCP, TFTP, FTP, and PXE server. I used a virtual machine with 8GB of RAM and a dual-core processor. You’re also going to need a client machine that supports PXE boot. A virtual machine can be used to test your PXE server.

Install the prerequisites

We need the following packages to perform our remote installation:
  • dnsmasq
  • vsftpd
  • syslinux
  • tftp-server
You can install all of these (or update if they are out-of-date) using:
yum install -y dnsmasq vsftpd syslinux tftp-server
You’re also going to need an ISO of your favourite Linux distribution. This will be the operating system that will be installed on your client. I chose Fedora Server 21 NetInstall. I recommend that you use a NetInstall image as it reduces the space needed on your server and speeds up the PXE install.

Setting up dnsmasq

DNSMASQ will act as the DHCP and PXE Server for us. The first thing we need to do is configure our DHCP options.

Configure a DHCP Server

  1. Run ip addr and note down the IP Address of this server (highlighted in red), and the interface name (highlighted in blue)
    ip addr shows you basic information about your network interfacesip addr shows you basic information about your network interfaces
  2. Make a backup of the default dnsmasq configuration file:
    mv /etc/dnsmasq.conf  /etc/dnsmasq.conf.backup
  3. Edit /etc/dnsmasq.conf and add the following lines – make sure to edit the parameters to meet your network:
    interface=,lo
    
    # DHCP range-leases
    dhcp-range= ,,,,1h
    
    # PXE
    dhcp-boot=pxelinux.0,pxeserver,
    
    # Gateway
    dhcp-option=3,
    
    # DNS
    dhcp-option=6, 8.8.8.8
    
    # Broadcast Address
    dhcp-option=28,
    
    If you don’t know your broadcast address you can find it using this Online IP Subnet Calculator
  4. Keep that file open, we’re going to keep using it in the next step

Configure a PXE Server

In the same file we were editing for our DHCP server, we’re going to add on this configuration options for our PXE server:
pxe-prompt="Press F8 for menu.", 60
pxe-service=x86PC, "Install Fedora 21", pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot
You can change around the pxe-prompt and the pxe-service but the important one is tftp-root To see all of the possible configuration options, check the DNSMASQ Manual.

Set up Syslinux

Syslinux is a group of smaller projects, one of which is PXELINUX which is a minimal Linux distribution meant to be used with PXE Installations. PXELINUX is not going to be installed on your system, rather just loaded into memory and used to install your actual operating system.
  1. Copy over syslinux into the tftpboot directory so that it will be copied onto our clients:
    cp -r /usr/share/syslinux/* /var/lib/tftpboot
  2. Create the configuration directory that PXELINUX will use to find its configuration file (made in the next step):
    mkdir /var/lib/tftpboot/pxelinux.cfg
  3. Create the file /var/lib/tftpboot/pxelinux.cfg/default and open it
  4. Add the following to the file, making sure to edit the IP address to match your servers:
    default menu.c32
    prompt 0
    timeout 100
    ONTIMEOUT local
    
    menu title ########## PXE Boot Menu ##########
    
    label 1
    menu label ^1) Install Fedora 21 Server NetInstall
    kernel fedora21/vmlinuz
    append initrd=fedora21/initrd.img method=ftp:///pub devfs=nomount
    
    label 2
    menu label ^2) Boot from local drive
    
  5. Save and close that file
Tip: notice how we are using FTP to transfer the kernal and initrd, if you didn’t want to use FTP, you could use HTTP, HTTPS, or NFS to name a few
Now we have to copy over the linux kernel and the initramdisk to our tftpboot directory, and the rest of the operating system to our FTP directory
  1. Start by mounting the ISO:
    mount -o loop  /mnt
    
  2. Copy the kernel and the ramdisk:
    mkdir /var/lib/tftpboot/fedora21
    cp /mnt/images/pxeboot/vmlinuz  /var/lib/tftpboot/fedora21
    cp /mnt/images/pxeboot/initrd.img  /var/lib/tftpboot/fedora21
    
  3. Copy the entire contents of the ISO to our public ftp directory and make it globally readable:
    cp -r /mnt/*  /var/ftp/pub/ 
    chmod -R 755 /var/ftp/pub
    

Start and Verify the services

Go ahead and fireup dnsmasq and vsftpd:
systemctl restart dnsmasq
systemctl status dnsmasq
systemctl restart vsftpd
systemctl status vsftpd
CentOS 7 has firewalld enabled by default. You can configure the firewall to allow the required incoming connections but in this tutorial we will simple disable the firewall:
systemctl stop firewalld
You should now be able to browse the public FTP directory of your server and see the contents of the ISO:
The Public FTP directory containing the installation files for Fedora 21The Public FTP directory containing the installation files for Fedora 21

Start a PXE Network Install

Start up your client machine and make sure that you eiter configure your boot order so that your network interface comes before your hard drive, or select it in your boot menu. Your client will then obtain an IP address from your DHCP Server and download pxelinux. You’ll be asked to press F8, and once you do you’ll be given a menu with only one option. Press enter to start pxelinux.
After pressing F8, you’ll see this menu with only one optionAfter pressing F8, you’ll see this menu with only one option
You will then see the PXE Boot Menu with the two options we configured earlier, you can either wait 10 seconds for the default item to be selected or press enter.
The PXE Boot menu, please note that mine will look different as I have changed some of the valuesThe PXE Boot menu, please note that mine will look different as I have changed some of the values
Your client will then download the kernel and ramdisk from your server, then initialize the installer. There may be moments when the system appears to not be doing anything when it is actually downloading the files from your server over FTP. If everything worked, the installation GUI will appear
Welcome to Fedora-Server 21!Welcome to Fedora-Server 21!
And that’s all there is to it! At this point, the job of the PXE Server is complete and the rest of the installation is completed like any other. You’ve successfully set up a PXE Server and can now install Linux on clients without a DVD, USB, or CD! I hope you enjoyed this tutorial and if you have questions please submit them in the comments below.

Saturday, February 28, 2015

Configure JAVAC and JAVA in Linux

Download Java SE 7 JDK for Linux x86 archive. At the time of writing, the file I'm using is jdk-7u21-linux-i586.tar.gz, but the filename will change as updates are released.
    Apparently there is no longer a jvm folder, so create one.

    sudo mkdir /usr/lib/jvm

    Move the archive to the jvm folder

    
 sudo mv jdk-7u21-linux-i586.tar.gz /usr/lib/jvm/

    Change to the jvm folder and extract the JDK from the archive

    cd /usr/lib/jvm

    sudo tar zxvf jdk-7u21-linux-i586.tar.gz

    Everything will be extracted to a new jdk1.7.0_21 folder and you can delete
the archive file now.
  
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6.31-oracle/bin/javac" 1
sudo update-alternatives --config javac
  
similarly for java use java

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6.31-oracle/jre/bin/java" 1
sudo update-alternatives --config java

Double-check the version
    java -version

6 Excellent Lightweight Linux Distros for Programming

6 Excellent Lightweight Linux Distros for x86 and ARM

Presenting a nice assortment of lightweight yet fully-functional Linux distros for all occasions. All of these are full distros that do not depend on cloud services; four for x86 and two, count 'em, two for ARM hardware.

Elementary OS

Elementary OS is a beautiful, fast, lightweight Linux for 32- and 64-bit x86. It is built on an Ubuntu core, and Elementary's desktop environment, Pantheon, started out with some stripped-down GNOME 2 elements. But it is more than an Ubuntu respin or GNOME fork-- a lot of custom development goes into Elementary OS, including apps and its development toolkit.

fig1-elementary os distro
Figure 1: Elementary OS.

A significant aspect of Elementary OS is the inclusion of accessibility features for hearing, sight, and motor-impaired users. The state of accessibility technologies in Linux is far behind where they should be, so it's encouraging to see a distro building them into its core system. Elementary OS has a bit of a Mac-like feel with a sleek, elegant appearance, subtle highlighting cues, minimal clicks to get from one place to another, and lots of useful super key shortcuts. I expect that even inexperienced Linux users could start using Elementary OS and be productive with just a little bit of poking around.
There is currently $5,755 of cash bounties available for bug-fixing some applications and base libraries. If you can't code, putting a few bucks in the bounty kitty is a great way to support Elementary OS.

LXLE

LXLE takes Lubuntu LTS (long-term support), customizes the LXDE desktop, adds proprietary codecs and drivers and a thoughtful selection of default applications, and advertises it as a drop-in replacement for Windows. Me, I think anything is a good replacement for Windows, including an Etch-a-Sketch. But LXLE (Lubuntu eXtra Life Extension) really is an excellent choice for users who want to swap Linux for Windows.
fig2-lxle-distro
Figure 2: LXLE has the best wallpapers.

LXLE is not amazing new revolutionary technology, but rather an excellently-crafted and refined enhancement of Lubuntu 12.04 and 14.04. The last 5 percent is the hardest, and LXLE goes all the way and finishes that last 5 percent. Installation is fast and simple, and it boots up very quickly. LXLE has five desktop looks to choose from: Unity, Windows XP, GNOME 2, Mac OS X and Netbook. Its most fun feature for me is the 100+ included beautiful wallpapers, and the Random Wallpaper button to cycle them automatically. Windows refugees, or any casual user, will find their way around easily. It also includes the full capabilities of Linux for power users. That is why I love Linux: we can have it all. (32- and 64-bit x86)

Arch Linux ARM

Arch Linux is the choice of fine nerds everywhere who want a simple yet versatile, up-to-date, lightweight rolling distribution. Arch calls itself simple because it comes with a minimum of bells and whistles, and is for users who want maximum control of their systems with no backtalk from "helpful" utilities.
Arch supports x86, and also has an excellent ARM port. ARM devices are everywhere thanks to single-board computers like Raspberry Pi, Beagleboard, and Arduino, smartphones, tablets, and netbooks like the Samsung Chromebook. Arch is extremely customizable, so you can pare it down to fit even the smallest SBC and make it into a router, a special-purpose server, or even a tiny but useful portable desktop computer. Just like x86 Arch, ARM Arch is well-documented and has active community support.


Point Linux

Point Linux is a baby, barely a year old. It is based on Debian 7 and the MATE desktop, which was originally forked from GNOME 2. So it has a traditional system menu and panels-- nice and clean, and everything easy to find with no dancing icons, no hidden things that appear only when you luck out and hover your cursor over the exactly correct spot, and virtual desktops that stay put. It runs well on old feeble hardware, and comes with a good basic selection of applications. Point Linux is based in Russia, and has good comprehensive localization. If you miss the Ubuntu of old, when it had the best GNOME 2 implementation of any distro, then you might like Point Linux. (32- and 64-bit x86)
pointlinux distro
Figure 4: Point Linux.

Porteus

Porteus was originally named Slax Remix. Porteus is a combination of "portability" and "Proteus", the god of the sea who could change his form. This is a reference to Porteus' flexibility; it weighs in at less than 300MB, and is optimized to run from a USB stick, CD, Compact Flash, or hard disk. It's a great way to get a prefab version of Slackware all ready to go to work.
fig5 porteus
Figure 5: Porteus.

You get a choice of five, count 'em, five desktop environments: KDE4, Razor, LXDE, MATE, or Xfce. Porteus includes a package manager, so you can install and remove packages to your heart's content. In my un-humble opinion it is the best portable Linux.

Fedora ARM

Fedora's ARM port has finally been promoted to primary architecture status, as of the Fedora 20 release in December 2013. This is a significant step because it now gets equal priority with the x86 releases, and no packages are pushed into repositories if they fail to build. In typical Fedora fashion, ARM support is broad and pushes into the bleeding edge with support for 64-bit ARM, all the popular ARM SBCs, and a nice selection of unofficial remixes for unsupported devices including the Samsung Chromebook. Which I keep mentioning because it looks like a perfect travel notebook once you clear the Google gunk off and install a good proper Linux on it. Visit the Fedora ARM wiki page to learn everything.
fig6 fedora unity desktop
Figure 6: Fedora's Unity desktop.

Dual boot problems in Ubuntu 14.04 and windows 8.1