Latest Posts

How to block all incoming traffic excepting specified services

For your own security, sometimes we want to filter all incoming traffic to our machine and let it go to only some specified ports. We can do it easily using IPTables.

Here is the simple command, which will DROP all incoming traffic to all ports excepting 80,443 (HTTP):
iptables -A INPUT -p tcp -m tcp -m multiport ! --dports 80,443 -j DROP

List of common used ports is here.

Remember to allow yourself to connect to SSH port :)

How to install Atom editor on Ubuntu 64bit

Atom – the open-source editor, developed by GitHub was realeased for 64-bit Ubuntu (or derivative) users.

Here is the short how to about installing Atom on your Ubuntu machine. For now it works only for 64-bit machines.

git clone https://github.com/atom/atom
cd atom
script/build # Creates application at /tmp/atom-build/Atom
sudo script/grunt install # Installs command to /usr/local/bin/atom

We’ll now also try to check how really Atom is and you can find our opinion soon.

 

DD

Crontab useful keywords

In this short article I would like to remind you few useful keywords which you can use to describe your cron jobs in simple way.

Their names sufficiently describes how specified keyword works, but I prepared a short table with description where you can also find equivalent for keyword in regular “cron language” and how it acts.

Keyword Equivalent Description
@yearly 0 0 1 1 * Run job every year
@daily 0 0 * * * Run job every day
@hourly 0 * * * * Run job every full hour
@reboot Run job at system startup

To edit your crontab, you use:
crontab -e

To see actual crontab for your current user:
crontab -l

Here is a real-life example of keywords usage in crontab:

@daily /usr/sbin/cron-apt
@reboot /usr/sbin/cron-apt

It runs cron-apt (auto update tool for your aptitude) command every day and after every reboot.
You can read more about cron-apt here.

 

DD

How to automatically update your Ubuntu/Debian every day?

If you were ever tired of everyday manual update of your debian packages, we can recommend a very simple way to do it automatically every period you want.

There are several ways to do that, I’ll show you simplest one to do that.

There is a nice debian package in repo, which do all magic for you. Just simply install it:

sudo apt-get install cron-apt

Configuration file you can find in /etc/cron-apt .

Informations about writing config file are inside file:

/usr/share/doc/cron-apt/README.gz

The most common option for us will be sending mail after every upgrade error. To do that, add following lines to /etc/cron-apt/config:

MAILON=”error”

MAILTO=”email@domain.com”

Now, edit your crontab and add automatic update everyday:

crontab -e

Add this line to your crontab to run job daily:

@daily /usr/sbin/cron-apt

Save file and enjoy your auto-updating-everyday Ubuntu :)

DD

How to install GitHub on Ubuntu Server with Nginx [tutorial]

GitLabControl-Full-Light

GitLab offers git repository management, code reviews, issue tracking, activity feeds and wiki’s. Enterprises install GitLab on-premise and connect it with LDAP and Active Directory servers for secure authentication and authorization. A single GitLab server can handle more than 25,000 users but it is also possible to create a high availability setup with a warm standby server.

As you can read in description from gitlab.org, GitLab is powerful tool which you can use in small projects, whether big companies which are deploying many of solutions every day.

In this tutorial you’ll teach yourself how to install and configure GitLab on your dedicated server.

Tested on: Ubuntu 13.10 Server, should work on other Debian/Ubuntu distributions.

1. First step is to download .deb package of GitLab prepared for your Linux distribution and system architecture:

cd /tmp

mkdir gitlab

wget https://downloads-packages.s3.amazonaws.com/gitlab_6.7.5-omnibus-1.ubuntu.12.04_amd64.deb

2. Once you downloaded, it’s time to install the package

sudo dpkg -i gitlab_6.7.5-omnibus-1.ubuntu.12.04_amd64.deb

It may take a while, so please write few lines of useful code at the moment, after installation you’ll be able to commit it to your own git repository.

3. Time to decide how you want to show your GitLab to the world. You have few options, i’ll show you how to deploy it on your own server’s subdomain.

First, you should add an A record to your DNS zone (it’s usually file in /etc/bind with name of your domain).

Add this line to your file:

git        IN      A       0.0.0.0

Don’t forget to replace “0.0.0.0″ with your server’s IP address.

Restart bind:

sudo service bind9 restart

Now your DNS server is ready to handle your newly added subdomain.

Then you should configure nginx which binaries are included in GitLab files to serve files on that subdomain.

Open file:

sudo vim /var/opt/gitlab/nginx/etc/gitlab-http.conf

In section server, find line which starts with:

server_name

And replace it with:

server_name git.example.com;

Naturally you should change example.com to your domain name.

If you’re DNS Records are already propagated, you can now start you GitLab instance:

sudo gitlab-ctl start

Now I recommend to wait 2 minutes and give time ruby’s magic to run your GitLab service. After that, you check:

http://git.example.com

If everything went well, you’ll see your own GitLab welcome screen.

Here you must do first login using standard credentials:

Login: root

Password: 5iveL!fe

Hope this article was helpful!

DD

About blog

devops software development and administration

Welcome to DevOps Blog!

Here you can find some information about working in DevOps methodology. We mainly develop in Python and operate in Debian/Ubuntu systems, but we don’t avoid any other technologies, so you’ll surely find something interesting for you.

Team