Thursday, April 6, 2017

Connect to ubuntu server from mac - GUI

How to connect to a unity in ubuntu server from mac

There are a plenty of tools out there to connect from your mac to Ubuntu server, right from your trusted command prompt to webdmin. They are different from each other or most of these do not connect you to ubuntu GUI server.

I prefer to work on terminal, but I can't speak for all. Many love ubuntu desktop and for them not seeing it on their server is a big let down.

For those, here's how I got it working, please try and let me know if this works for you too.

Ensure you have the basic installation of these packages done on your ubuntu server
Open terminal and navigate to you home directory, install the following

sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

If you are asked for permission to change the file system during installtion process, say 'yes' or 'y'

Install VNC server
sudo apt-get install vnc4server

Launch VNC server
vncserver :1

With all this setup, try to connect from your mac to ensure there are no connectivity issues
ssh -L 5901: my_user_name@server_name
ssh -L 5901: my_user_name@server_ip

If all is well, it's time to connect through VNC
Install RealTimeVNC Viewer from here

Post installation, open the vnc viewer, add a new connection. Make sure you IP address is followed by :1. e.g. it should be something like

When you attempt to open the connection, you'll be prompted for encryption and password.

Punch in the password. Now you should be connected

Back to your LINUX server

Kill vnc session
vncserver -kill :1

Browse to your home directory and open up the file .vnc/xstartup. Add the following contents to it
# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey 
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &

Save and exit

Start VNC server
vncserver :1

Here's what I see after all of this in my VNC Server - Mac

Here's how the connected server looks like

You should see a familiar basic unity show up. If you don't see it. Disconnect and re-connect

Saturday, March 25, 2017

Service in Ubuntu

What is service utility in ubuntu?
"service" command is the preferred way utility to start, stop, list all services. to see all running services we can do the following
"sudo service --status-all".

How do I start/stop a service
To start a service - sudo service <service-name> start
To stop a service - sudo service <service-name> stop

How do I chaeck the status of a service
sudo service <service-name> status.
This command will give you a whole raft of information.  This detailed information includes location where service is installed, its status, how long has it been running, commands that are a part of the service, their location information, log locations and top 10 lines of the logs.

List of operations that are possible on a service include the following
start, stop, restart, force-reload, status.

Why should I know so much about Services
As a developers there are numerous occasions where you'll need to start/stop/re-start your application server. Gone are the days where services are installed in init.d directory locations. Also when you are done, you may want to stop the service. You may not want services like mysql, apache, wordpress, jenkins running all the time in your box, unless you need them. Here's where some information on service helps.

What about my snappy Wifi
And now to one of the most common problem in LINUX. If you have not installed the right drivers, for your Wifi connections, chances are your wifi connection is snappy at best. Only way you can resolve connection issue in the past is to re-start your box. Not anymore. You can solve this by restarting the network-manager service.

Here's the command
"sudo service network-manager restart"

What about snappy audio?
There are times when audio would not work, expecially when you connect to external audio devices and disconnect them. Easiest way to rid this issue is re-start pulse audio service

pulseaudio -k && sudo alsa force-reload

Next time your connection goes off, no sweat, you should be able to fix it in a second with the above command.