linux, coffee and other stuff | part iii

as the 3rd day dawned on the realm, the warriors were weak. it was another dreary day. creatures of all sorts crawled their way to the battlefield, their armors shining.Β  weathered over time… warriors slowly gathered to the filed, where they were about to scream out their battle cry.

“where….issss…maaaa…coffeeee!”

nah just kidding, just getting over my monday blues! hello there. here’s my 3rd day as an intern. *yawn* oops! sorry!

this was my first monday as a working person. heh. working person. look at me all suited up. nah. it’s just casuals over here. think that’s one upside of being a software engineer (i mean, to be one), most of the places you are allowed a casual theme.

so here goes my tasks for today. get used to vim. complete installing mysql and intellij idea.

so. what the hack is vim? well, linux.com explains it as “Vim is the editor of choice for many developers and power users. It’s a “modal” text editor based on the vi editor written by Bill Joy in the 1970s for a version of UNIX. It inherits the key bindings of vi, but also adds a great deal of functionality and extensibility that are missing from the original vi.” For me, it’s just not using gEdit or any other text editors to edit text but edit everything inside the terminal itself. read more on vim 101: linux.com.

how to get vim? *drum roll please*

sudo apt-get install vim

yes, we were allowed to use apt-get to install vim. so simple as that. you’ll have vim installed in your linux system. *woot* πŸŽ‰

now how to use vim? it’s quite easy. you get an inbuilt training program with vim itself. you can follow that to get started. to know all the shortcuts, go to vim cheat sheet. this has all the commands/keys needed to manipulate yourself on the terminal using vim.

using vim will train you even more to use the terminal. heyyyy, look who’s using the terminal like “pro hacker” now! πŸ˜›

so now, get cracking with with. go.. urm.. like now? maybe? yes. you may drink some coffee too. tea? sigh. okay.

next up, it’s intellij idea. as you know, idea is an ide. here you can easily create java, android, web apps etc and it has a nice gui.

*ducks under the desk as not to anger the anti-gui gods.*

urm. yes. moving on. you can get intellij idea by going to www.jetbrains.com. current version as per today is 14.1. so, get the latest version for your machine.

once you download the, urm, the tar ball, heh, yes, extract the contents. you can move this folder to wherever you may want it to be. just remember the path okay?

okay done? cool. now on your terminal (got it right that time! πŸ‘Š), change directory to where you extracted intellij idea, change directory to the bin folder inside.

now run,

sh idea.sh

hey! look who’s running intellij now eh? you’ll have to configure some details on the first run, like where you have installed the jdk and what not. and. urm, you’ll have to “buy” the license. hehe. yeah, buy. πŸ˜›

now you may go code your complicated hello world program.

once you’re done, you might notice that you can’t actually find it on the search and every time you’ll have to move to the bin and run that script. since this can be a little hassle, you can create a desktop link.

[Desktop Entry]
Name=IntelliJ IDEA
Comment=IntelliJ IDEA IDE
Exec=/home/user/Downloads/idea/bin/idea.sh
Icon=/home/user/Downloads/idea/bin/idea.png
Terminal=false
StartupNotify=true
Type=Application
Categories=Development;IDE;

copy the contents above and save it as idea.desktop. make sure you change the paths of exec and icon appropriately to wherever you extracted the tar ball. hehe. πŸ˜‚

okay? done? now, copy or move that idea.desktop file to /usr/share/applications. this fol.. i mean, directory, contains details about applications installed. so, once you do this, you will see idea on the search and now you can drag and drop it to the side bar thingy on ubuntu. read more about this on developer.gnome.org.

so the last thing for the day, mysql. gah, this was really hectic. installing mysql without using apt-get can be a really a pain…

so make sure you follow the steps properly, or face the consequences like i did.
πŸ˜‚πŸ˜Šβ˜ΊοΈπŸ˜πŸ˜‘πŸ˜•πŸ˜£πŸ˜€πŸ˜­

first of all, make sure you have uninstalled all of the previous installations of mysql from the system. this is a must!

to do that, run these.

sudo apt-get remove –purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

this clears up your system. now, take sip from your coffee, and get ready! *game face on*

fire up your terminal and go to sudo mode.

sudo su

now you’re on root. now, we have to disable the app armor since it can block the manually installed mysql from running. for this, run these next few codes.

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils

cool? some long texts will appear on the screen and you’re allowed to look cool while all this happens.

right, next up, we need to create a group and a user called mysql. to do that, you might already know this, run these codes.

groupadd mysql
useradd -r -g mysql mysql

all good? okay. now we have to get the libaio1 package. what is that you ask? you can read up more at debian.org

apt-get install libaio

okay. now, change your directory to /usr/local by running, cd /usr/local

this is where you’re going to download (or copy) and extract the mysql tar ball.

you can use the following command to download the tar ball, or if you have already downloaded the tar ball, move/copy it to here.

wget -O mysql-5.6.8-rc-linux2.6-x86_64.tar.gz http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.8-rc-linux2.6-x86_64.tar.gz/from/http://cdn.mysql.com/

now, extract the tar ball.

tar xvfz mysql-5.6.8-rc-linux2.6-x86_64.tar.gz

now, move that extracted contents to a new folder called mysql.
mv mysql-5.6.8-rc-linux2.6-x86_64 mysql

now, go into that directory.

cd mysql

and now, make that mysql fold..directory ownership to mysql group and user we created before.

chown -R mysql .
chgrp -R mysql .

note the dot, because i didn’t. yes. *shakes head*

now run this script.

scripts/mysql_install_db –user=mysql

now, change ownership.

chown -R root .
chown -R mysql data

now, copy the init script mysql.server to /etc/init.d

cp support-files/mysql.server /etc/init.d/mysql.server

so, urm, yeah. now you can run the mysql server.

/etc/init.d/mysql.server start

also, we need to start the server on boot time, to do that, run this script. else, every time you’ll have to run the server manually.

update-rc.d mysql.server defaults

now for our convenience, we add the mysql bin to the system path. so we can run mysql just by typing in… mysql. πŸ˜›

ln -s /usr/local/mysql/bin/* /usr/local/bin/

okay? cool? now, let’s configure our mysql installation shall we? now pay close attention. yes, like seriously!

this step will set the root password for mysql. please make sure you don’t enter a password when you run the following code. read the information properly!

mysql_secure_installation

hit enter now. then you’ll be asked to add a root password. and, now, and now only you may add a password for root. you’ll be asked to enter that twice.

once it’s done, press enter for all the other questions… aaaaaaaaaaaaaand, you’re done!

tada! you have successfully installed mysql on your system. this deserves a venti, half-whole milk, one quarter 1%, one quarter non-fat, extra hot, split quad shots (1 1/2 shots decaf, 2 1/2 shots regular), no foam latte, with whip, 2 packets of splenda, 1 sugar in the raw, a touch of vanilla syrup and 3 short sprinkles of cinnamon.” 😱

now you can come out of the sudo mode, you can start mysql mode in the terminal my running mysql -u root -pPA$$W0RD

so, all cool? was kind of a long day right? well, that’s kinda how these things are noh. oh well, damn i’m drinking too much coffee these days.

then, till the next time…

……and the shadows fell over the mountains to the realm, as the monsters wept into the nights, the warriors logged out from their pcs.. i mean they lay down their swords for a well deserved sleep.

adios! 😊

Advertisements

spill a bit of coffee?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s