Search

Just Another Tech Blog

A mind is like a parachute. It doesn't work if it is not open.

Category

Ubuntu

How To Install and Use Docker on Ubuntu 16.04


Prerequisites

To follow this tutorial, you will need the following:

  • 64-bit Ubuntu 16.04 server
  • Non-root user with sudo privileges

Note: Docker requires a 64-bit version of Ubuntu as well as a kernel version equal to or greater than 3.10. The default 64-bit Ubuntu 16.04 server meets these requirements.

All the commands in this tutorial should be run as a non-root user. If root access is required for the command, it will be preceded by sudo.

Step 1 — Installing Docker

The Docker installation package available in the official Ubuntu 16.04 repository may not be the latest version. To get the latest and greatest version, install Docker from the official Docker repository. This section shows you how to do just that.

First, add the GPG key for the official Docker repository to the system:

  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to APT sources:

  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Next, update the package database with the Docker packages from the newly added repo:

  • sudo apt-get update

Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:

  • apt-cache policy docker-ce

You should see output similar to the follow:
Output of apt-cache policy docker-ce

docker-ce:
  Installed: (none)
  Candidate: 17.03.1~ce-0~ubuntu-xenial
  Version table:
     17.03.1~ce-0~ubuntu-xenial 500
        500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
     17.03.0~ce-0~ubuntu-xenial 500
        500 https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 16.04. The docker-ce version number might be different.

Finally, install Docker:

  • sudo apt-get install -y docker-ce

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

  • sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:
Output:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2016-05-01 06:53:52 CDT; 1 weeks 3 days ago
     Docs: https://docs.docker.com
 Main PID: 749 (docker)

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client. We’ll explore how to use the docker command later in this tutorial.

Step 2 — Executing the Docker Command Without Sudo (Optional)

By default, running the docker command requires root privileges — that is, you have to prefix the command with sudo. It can also be run by a user in the docker group, which is automatically created during the installation of Docker. If you attempt to run the docker command without prefixing it with sudo or without being in the docker group, you’ll get an output like this:
Output:

docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

  • sudo usermod -aG docker ${USER}

To apply the new group membership, you can log out of the server and back in, or you can type the following:

  • su - ${USER}

You will be prompted to enter your user’s password to continue. Afterwards, you can confirm that your user is now added to the docker group by typing:

  • id -nG

Output:

sammy sudo docker

If you need to add a user to the docker group that you’re not logged in as, declare that username explicitly using:

  • sudo usermod -aG docker username

The rest of this article assumes you are running the docker command as a user in the docker user group. If you choose not to, please prepend the commands with sudo.

Step 3 — Using the Docker Command

With Docker installed and working, now’s the time to become familiar with the command line utility. Using docker consists of passing it a chain of options and commands followed by arguments. The syntax takes this form:

  • docker [option] [command] [arguments]

To view all available subcommands, type:

  • docker

As of Docker 1.11.1, the complete list of available subcommands includes:

Output:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
update Update configuration of one or more containers
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code

To view the switches available to a specific command, type:

  • docker docker-subcommand --help

To view system-wide information about Docker, use:

  • docker info

Step 4 — Working with Docker Images

Docker containers are run from Docker images. By default, it pulls these images from Docker Hub, a Docker registry managed by Docker, the company behind the Docker project. Anybody can build and host their Docker images on Docker Hub, so most applications and Linux distributions you’ll need to run Docker containers have images that are hosted on Docker Hub.

To check whether you can access and download images from Docker Hub, type:

  • docker run hello-world

The output, which should include the following, should indicate that Docker in working correctly:

Output:

Hello from Docker.
This message shows that your installation appears to be working correctly.
...

You can search for images available on Docker Hub by using the docker command with the searchsubcommand. For example, to search for the Ubuntu image, type:

  • docker search ubuntu

The script will crawl Docker Hub and return a listing of all images whose name match the search string. In this case, the output will be similar to this:

Output:

NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating s... 3808 [OK]
ubuntu-upstart Upstart is an event-based replacement for ... 61 [OK]
torusware/speedus-ubuntu Always updated official Ubuntu docker imag... 25 [OK]
rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 24 [OK]
ubuntu-debootstrap debootstrap --variant=minbase --components... 23 [OK]
nickistre/ubuntu-lamp LAMP server on Ubuntu 6 [OK]
nickistre/ubuntu-lamp-wordpress LAMP on Ubuntu with wp-cli installed 5 [OK]
nuagebec/ubuntu Simple always updated Ubuntu docker images... 4 [OK]
nimmis/ubuntu This is a docker images different LTS vers... 4 [OK]
maxexcloo/ubuntu Docker base image built on Ubuntu with Sup... 2 [OK]
admiringworm/ubuntu Base ubuntu images based on the official u... 1 [OK]

 

In the OFFICIAL column, OK indicates an image built and supported by the company behind the project. Once you’ve identified the image that you would like to use, you can download it to your computer using the pull subcommand, like so:

  • docker pull ubuntu

After an image has been downloaded, you may then run a container using the downloaded image with the run subcommand. If an image has not been downloaded when docker is executed with the runsubcommand, the Docker client will first download the image, then run a container using it:

  • docker run ubuntu

To see the images that have been downloaded to your computer, type:

  • docker images

The output should look similar to the following:

Output:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              latest              c5f1cf30c96b        7 days ago          120.8 MB
hello-world         latest              94df4f0ce8a4        2 weeks ago         967 B

As you’ll see later in this tutorial, images that you use to run containers can be modified and used to generate new images, which may then be uploaded (pushed is the technical term) to Docker Hub or other Docker registries.

Step 5 — Running a Docker Container

The hello-world container you ran in the previous is an example of a container that runs and exits, after emitting a test message. Containers, however, can be much more useful than that, and they can be interactive. After all, they are similar to virtual machines, only more resource-friendly.

As an example, let’s run a container using the latest image of Ubuntu. The combination of the -i and -tswitches gives you interactive shell access into the container:

  • docker run -it ubuntu

Your command prompt should change to reflect the fact that you’re now working inside the container and should take this form:

Output:

root@d9b100f2f636:/#

Important: Note the container id in the command prompt. In the above example, it is d9b100f2f636.

Now you may run any command inside the container. For example, let’s update the package database inside the container. No need to prefix any command with sudo, because you’re operating inside the container with root privileges:

  • apt-get update

Then install any application in it. Let’s install NodeJS, for example.

  • apt-get install -y nodejs

Step 6 — Listing Docker Containers

After using Docker for a while, you’ll have many active (running) and inactive containers on your computer. To view the active ones, use:

  • docker ps

You will see output similar to the following:

Output:

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
f7c79cc556dd        ubuntu              "/bin/bash"         3 hours ago         Up 3 hours                              silly_spence

To view all containers — active and inactive, pass it the -a switch:

  • docker ps -a

To view the latest container you created, pass it the -l switch:

  • docker ps -l

Stopping a running or active container is as simple as typing:

  • docker stop container-id

The container-id can be found in the output from the docker ps command.

Step 7 — Committing Changes in a Container to a Docker Image

When you start up a Docker image, you can create, modify, and delete files just like you can with a virtual machine. The changes that you make will only apply to that container. You can start and stop it, but once you destroy it with the docker rm command, the changes will be lost for good.

This section shows you how to save the state of a container as a new Docker image.

After installing nodejs inside the Ubuntu container, you now have a container running off an image, but the container is different from the image you used to create it.

To save the state of the container as a new image, first exit from it:

  • exit

Then commit the changes to a new Docker image instance using the following command.

Note: If you run an image and made some modification and now want to save the modified image locally then follow the below steps:

  • use docker ps -a command to see the container listing and copy the container id.
  • now, use:
docker commit <container-id> <new-image-name>

It will save the modified modified image as the <new-image-name>. You can see the new modified image using the docker images command.

The -m switch is for the commit message that helps you and others know what changes you made, while -a is used to specify the author. The container ID is the one you noted earlier in the tutorial when you started the interactive docker session. Unless you created additional repositories on Docker Hub, the repository is usually your Docker Hub username:

  • docker commit -m "What did you do to the image" -a "Author Name" container-id repository new_image_name

For example:

  • docker commit -m "added node.js" -a "Sunday Ogwu-Chinuwa" d9b100f2f636 finid/ubuntu-nodejs

Note: When you commit an image, the new image is saved locally, that is, on your computer. Later in this tutorial, you’ll learn how to push an image to a Docker registry like Docker Hub so that it may be assessed and used by you and others.

After that operation has completed, listing the Docker images now on your computer should show the new image, as well as the old one that it was derived from:

  • docker images

The output should be similar to this:

Output:

finid/ubuntu-nodejs      latest              62359544c9ba        50 seconds ago      206.6 MB
ubuntu              latest              c5f1cf30c96b        7 days ago          120.8 MB
hello-world         latest              94df4f0ce8a4        2 weeks ago         967 B

In the above example, ubuntu-nodejs is the new image, which was derived from the existing ubuntu image from Docker Hub. The size difference reflects the changes that were made. And in this example, the change was that NodeJS was installed. So next time you need to run a container using Ubuntu with NodeJS pre-installed, you can just use the new image. Images may also be built from what’s called a Dockerfile. But that’s a very involved process that’s well outside the scope of this article.

 

Step 8 — Pushing Docker Images to a Docker Repository

The next logical step after creating a new image from an existing image is to share it with a select few of your friends, the whole world on Docker Hub, or other Docker registry that you have access to. To push an image to Docker Hub or any other Docker registry, you must have an account there.

This section shows you how to push a Docker image to Docker Hub. To learn how to create your own private Docker registry, check out How To Set Up a Private Docker Registry on Ubuntu 14.04.

To create an account on Docker Hub, register at Docker Hub. Afterwards, to push your image, first log into Docker Hub. You’ll be prompted to authenticate:

  • docker login -u docker-registry-username

If you specified the correct password, authentication should succeed. Then you may push your own image using:

  • docker push docker-registry-username/docker-image-name

It will take sometime to complete, and when completed, the output will similar to the following:

Output:

The push refers to a repository [docker.io/finid/ubuntu-nodejs]
e3fbbfb44187: Pushed
5f70bf18a086: Pushed
a3b5c80a4eba: Pushed
7f18b442972b: Pushed
3ce512daaf78: Pushed
7aae4540b42d: Pushed

...

After pushing an image to a registry, it should be listed on your account’s dashboard,

If a push attempt results in an error of this sort, then you likely did not log in:

Output:

The push refers to a repository [docker.io/finid/ubuntu-nodejs]
e3fbbfb44187: Preparing
5f70bf18a086: Preparing
a3b5c80a4eba: Preparing
7f18b442972b: Preparing
3ce512daaf78: Preparing
7aae4540b42d: Waiting
unauthorized: authentication required

Log in, then repeat the push attempt.

Conclusion

There’s a whole lot more to Docker than has been given in this article, but this should be enough to getting you started working with it on Ubuntu 16.04. Like most open source projects, Docker is built from a fast-developing codebase, so make a habit of visiting the project’s blog page for the latest information.

Please Note: The content of this page is collected from the https://www.digitalocean.com site for my personal reference in future use. Therefore, all the credit and copyrights goes to the mentioned site

Fix Docker’s networking DNS config


Sometimes, Docker‘s internet connectivity won’t be working properly, which can lead to a number of obscure errors with your applications. In my experience, this is usually because DNS lookups are failing in Docker images.

If you know it’s a DNS problem and you’re in a hurry, jump straight to the system-wide solution.

Is DNS the problem?

Fortunately it’s easy to test Docker’s DNS.

First, check that basic internet connectivity is working by pinging a public IP address. It should succeed, giving you output similar to this:

$ docker run busybox ping -c 1 192.203.230.10  # Ping a London-based NASA root nameserver
PING 192.203.230.10 (192.203.230.10): 56 data bytes
64 bytes from 192.203.230.10: seq=0 ttl=53 time=113.866 ms

--- 192.203.230.10 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 113.866/113.866/113.866 ms

But now try resolving the domain google.com:

$ docker run busybox nslookup google.com
Server:    8.8.8.8
Address 1: 8.8.8.8
nslookup: can't resolve 'google.com'

If it fails as shown above then there is a problem resolving DNS.

Why?

By default, if Docker can’t find a DNS server locally defined in your /etc/resolv.conf file, containers will default to using Google’s public DNS server8.8.8.8, to resolve DNS.

In some networks, like Canonical’s London office network where I work, the administrators intentionally block the use of public DNS servers to encourage people to use the network’s own DNS server.

In this case, Docker containers using the default configuration won’t be able to resolve DNS, rendering the internet effectively unuseable from within those containers.

I’ve filed a bug about this issue, although I don’t yet know when or if it might be addressed.

The quick fix: Overriding Docker’s DNS

Fortunately, it’s fairly easy to directly run a docker container with a custom DNS server.

Discover the address of your DNS server

You can find out what network’s DNS server from within Ubuntu as follows:

$ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]:                             10.0.0.2

Run Docker with the new DNS server

To run a docker container with this DNS server, provide the --dns flag to the run command. For example, let’s run the command we used to check if DNS is working:

$ docker run --dns 10.0.0.2 busybox nslookup google.com
Server:    10.0.0.2
Address 1: 10.0.0.2
Name:      google.com
Address 1: 2a00:1450:4009:811::200e lhr26s02-in-x200e.1e100.net
Address 2: 216.58.198.174 lhr25s10-in-f14.1e100.net

And that’s what success looks like.

The permanent system-wide fix

The above solution is all very well if you’re only temporarily inside a restrictive network and you only need to run containers directly.

However, most of the time you’ll want this to work by default and keep working on your system, and for any other programs that rely on Docker.

Update the Docker daemon

To achieve this, you need to change the DNS settings of the Docker daemon. You can set the default options for the docker daemon by creating a daemon configuration file at /etc/docker/daemon.json.

You should create this file with the following contents to set two DNS, firstly your network’s DNS server, and secondly the Google DNS server to fall back to in case that server isn’t available:

/etc/docker/daemon.json:

{
    "dns": ["10.0.0.2", "8.8.8.8"]
}

Then restart the docker service:

sudo service docker restart

Testing the fix

Now you should be able to ping google.com successfully from any Docker container without explicitly overriding the DNS server, e.g.:

$ docker run busybox nslookup google.com
Server:    10.0.0.2
Address 1: 10.0.0.2
Name:      google.com
Address 1: 2a00:1450:4009:811::200e lhr26s02-in-x200e.1e100.net
Address 2: 216.58.198.174 lhr25s10-in-f14.1e100.net

Please Note: This post is collected from https://robinwinslow.uk site. I am just posting the solution here as my future reference. All the credit and copyrights goes to the mentioned site.

How To Add Robot Framework Syntax in Sublime Text and VIM editor


By default, files for the Robot Framework do not show any syntax on Sublime Text or VIM, with some tweaks we can add Robot Framework syntax.

For Sublime Text 2:

Open Sublime Text 2 and click Preferences -> Browse Packages to open the packages directory. Then create a directory named Robot Framework containing the contents of the following repository:

https://github.com/seeamkhan/sublime-robot-plugin

Note: The contents of the repository should be directly under the Robot Framework directory.

Now close the Sublime Text 2 editor if it’s already been opened and then open a file with Robot Framework syntax, the syntax should be now visible like below:

Selection_012

For VIM Text Editor:

Clone the git repository in any place:

git clone https://github.com/seeamkhan/robotframework-vim

Go to the content directory:

cd robotframework-vim

Make sure the directory ~/.vim/ already exist for the current user, if not then create the directory:

mkdir ~/.vim

Now copy all the contents to ~/.vim/ location:

cp -R * ~/.vim/

Now open any files with Robot Framework syntax in the VIM editor, the syntax should be visible like below:

Selection_014

LAMP and Virtual Host


Every time I set-up a new Linux PC, I need to install LAMP and Virtual Hosts etc etc. Definitely, there are a lot of resources about how to do all those stuff but I have to spend a lot of time for finding those. Because, most of the time the site which I bookmarked last time does not found. Therefore, I am creating this post with collection of commands which will help for set-up LAMP and Virtual Host very quickly.

Setup LAMP:

Step 1: Install Apache

sudo apt-get update
sudo apt-get install apache2

When apache2 installation is done, try hitting http://localhost URL in the browser. It should show Apache2 Ubuntu default page.

Step 2: Install MySQL

sudo apt-get install mysql-server

sudo mysql_secure_installation

Answer y for yes, or anything else to continue without enabling.

You’ll be asked to select a level of password validation. Keep in mind that if you enter 2, for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words.

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1

For the rest of the questions, you should press Y and hit the Enter key at each prompt.

Step 3: Install PHP

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

To do this, type this command to open the dir.conf file in a text editor with root privileges:

sudo nano /etc/apache2/mods-enabled/dir.conf

It will look like this:

/etc/apache2/mods-enabled/dir.conf

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

We want to move the PHP index file highlighted above to the first position after the DirectoryIndexspecification, like this:

/etc/apache2/mods-enabled/dir.conf

DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

sudo systemctl restart apache2

Step 4: Test PHP Processing on your Web Server

sudo nano /var/www/html/info.php

This will open a blank file. We want to put the following text, which is valid PHP code, inside the file:

info.php

<?php phpinfo();
?>

Now visit: http://your_server_IP_address/info.php

sudo rm /var/www/html/info.php

Now the LAMP installation is done!

Now we need to create some virtual hosts. I have found a script which worked great for me, I have forked the script in my GIT, so here is the script: https://github.com/seeamkhan/virtualhost

Download as Zip,  then extract it.

You will find a directory named ‘virtualhost-master’. Open it and add exe permission for the ‘virtualhost.sh’ file:

$ chmod +x /path/to/virtualhost.sh

Now create virtual host by typing this command:

sudo virtualhost.sh create mysite.com

Now browse http://mysite.com

Install phpMyAdmin:

To get started, we can simply install phpMyAdmin from the default Ubuntu repositories.

sudo apt-get update
sudo apt-get install phpmyadmin php-mbstring php-gettext
  • For the server selection, choose apache2.
  • Select yes when asked whether to use dbconfig-common to set up the database
  • You will be prompted for your database administrator’s password
  • You will then be asked to choose and confirm a password for the phpMyAdmin application itself

The installation process actually adds the phpMyAdmin Apache configuration file into the /etc/apache2/conf-enabled/ directory, where it is automatically read.

The only thing we need to do is explicitly enable the PHP mcrypt and mbstring extensions, which we can do by typing:

sudo phpenmod mcrypt

sudo phpenmod mbstring

Afterwards, you’ll need to restart Apache for your changes to be recognized:

sudo systemctl restart apache2

You can now access the web interface by visiting your server’s domain name or public IP address followed by /phpmyadmin:

https://domain_name_or_IP/phpmyadmin

If you get a 404 error upon visiting http://localhost/phpmyadmin:You will need to configure apache2.conf to work with Phpmyadmin.

$ gksudo gedit /etc/apache2/apache2.conf

Include the following line at the bottom of the file, save and quit.

Include /etc/phpmyadmin/apache.conf

Now Restart the apache server and try again to phpmyadmin:

sudo systemctl restart apache2

Decorate Terminal


Everyone loves to decorate their PC. Specially when you are working in a Linux OS there are lots of opportunity to customize and decorate. Here’s a simple one, about how to change user and host name color in terminal:

This is very simple, just open the terminal and type this to edit the .bashrc file:

sudo leafpad ~/.bashrc

Now uncomment the following line:

#force_color_prompt=yes

Then go to the following lines:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Pay attention at the part \u@\h it is saying “user@host” and the number before it \[\033[01;32m\] indicates the color. This is what you have to change. For example, lets change the “user” for red, the “@host” for white, edit the line to looks like:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;37m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Now save the file.

Close the terminal and open it again.

Bingo!!

Shutter Plugin for Simple Border


Shutter is a feature-rich screenshot program for Linux based operating systems such as Ubuntu. You can take a screenshot of a specific area, window, your whole screen, or even of a website – apply different effects to it, draw on it to highlight points, and then upload to an image hosting site, all within one window. Shutter is free, open-source, and licensed under GPL v3.

Official website: http://shutter-project.org/

I have made a simple plugin using shell scripting for Shutter to add a simple 1 pixel black border on the image.

Install shutter

Open terminal and run the following command one by one.

sudo apt-get update
sudo apt-get install shutter

It should install shutter in your ubuntu.

Now from Dashboard search “shutter” and confirm that it has installed.

Configure Shutter

Open shutter and press Alt+P or go to Preferences from menu.

Now click Action tab from left and make the following changes:

  • Check Open wiht Built-in Editor
  • Check Border and make it 1 pixels and color black.

Selection_047
Now click on Behaviour tab and confirm the settings are same as the bellow image:

Selection_048

Now Close the Preferences.

Keyboard Short-cut Settings for Shutter

In Ubuntu dashboard type keyboard and press enter or go to Keyboard settings manually.

After opening Keyboard settings window click “Shortcuts” tab then click “+” icon bellow.

Selection_049

A pop-up will appear type “Shutter” in the Name field and “shutter -s” in Command field then click Apply.

Selection_050

A warning pop-up will appear click Reassign.

Selection_051

Now add another short-cut by clicking “+” icon.

Here the Name should “Shutter full” and Command should “shutter -f”.

Now Apply and click Reassign.

Selection_052

Now close the Keyboard setting.

Now Pressing the Print Screen button on keyboard will appear the screen capture window
with selection area option.

And Cltr+Print Screen button will capture the full screen.

Adding border after editing

If after editing any image the pre-selected border got cut off you can add another using Simple Border Plugin. Simple Border plugin Download.

Please see the Readme.txt file for detail instruction.

Now Quit shutter and run it again.

Now open any image in shutter, press Cltr+Shift+P or right click on the image and click “Run a Plugin”,

select ”Plain Border” and Run.

It will add a border on the image.

Selection_057

How to Create Lan/Samba sharing from Ubuntu


  1. install Samba
    sudo apt-get update
    sudo apt-get install samba
  2. Set a password for your user in Samba
    • sudo smbpasswd -a <user_name>
      • Note: Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd), so you'll need to create a Samba password for yourself. This tutorial implies that you will use your own user and it does not cover situations involving other users passwords, groups, etc...

         

        Tip1: Use the password for your own user to facilitate.

         

        Tip2: Remember that your user must have permission to write and edit the folder you want to share.
        Eg.:
        sudo chown <user_name> /var/opt/blah/blahblah
        sudo chown :<user_name> /var/opt/blah/blahblah

         

        Tip3: If you're using another user than your own, it needs to exist in your system beforehand, you can create it without a shell access using the following command :
        sudo useradd USERNAME --shell /bin/false
        
        You can also hide the user on the login screen by adjusting lightdm's configuration, in /etc/lightdm/users.conf add the newly created user to the line :
        hidden-users=

         

  3. Create a directory to be shared [optional]
    mkdir /home/<user_name>/<folder_name>
  4. Make a safe backup copy of the original smb.conf file to your home folder, in case you make an error
    sudo cp /etc/samba/smb.conf ~
  5. Edit the file “/etc/samba/smb.conf”
    sudo nano /etc/samba/smb.conf
    • Once "smb.conf" has loaded, add this to the very end of the file:
      
      [<folder_name>]
      path = /home/<user_name>/<folder_name>
      available = yes
      valid users = <user_name>
      read only = no
      browseable = yes
      public = yes
      writable = yes

       

      Tip: There Should be in the spaces between the lines, and note que also there should be a single space both before and after each of the equal signs.

       

  6. Restart the samba:
    sudo service smbd restart
  7. Once Samba has restarted, use this command to check your smb.conf for any syntax errors
    testparm
  8. To access your network share

    To access your network share use your username (<user_name>) and password through the path “smb://<HOST_IP_OR_NAME>/<folder_name>/” (Linux users) or “\\<HOST_IP_OR_NAME>\<folder_name>\” (Windows users). Note that “<folder_name>” value is passed in “[<folder_name>]”, in other words, the share name you entered in “/etc/samba/smb.conf”.

    • Note: The default user group of samba is "WORKGROUP".
  9. Now from GUI go to any directory.
  10. Right click on it > go to Properties.
  11. Click “Local Network Share” > Click “Share this folder” > click “Create share” at the right bottom.
  12. Now it is done.
  13. Go from any network PC and hit the ip address.
  14. Use user/pass (samba) and happy Browsing!! 🙂

Source

Blog at WordPress.com.

Up ↑