sudo – what is it?

If you’ve been following my posts for a while, you will have also noticed the use of the sudo command in a lot of the Unix/Linux configuration and setup instructions. This is because of the security model used by these operating systems. Users generally have limited access, and only the ‘root’ or admin accounts has greater access. A common convention is to use the sudo command to allow for temporary (usually 5 minutes at a time) permission to make changes, using escalated rights for an existing non root user.

It’s often best to think of “sudo” as “mother may I”, as the server administrator can give users access to some (but not all) commands.

Permissions are stored in a file that can be edited in a variety of manners (do so carefully):
/etc/sudoers

To give an existing user permission to use sudo…

sudo adduser USERNAME sudo

REFERENCES:

LinSSID

If you have ever used the popular software InSSIDer on Windows or OS/X, you might wonder if there is an equivalent application for Ubuntu/Linux.

LinSSID allows you to visually survey the Wifi networks in your area, identifying networks using the same channel as your own, even if they are not broadcasting SSID’s.


sudo add-apt-repository ppa:wseverin/ppa
sudo apt-get update
sudo apt-get install linssid

— OR —

sudo vi /etc/apt/sources.list
deb http://ppa.launchpad.net/wseverin/ppa/ubuntu YOUR_UBUNTU_VERSION_HERE main

NOTE: it seems that the release version is only available for ‘precise’ and has not been updated for newer Ubuntu releases, I was able to simply go to the terminal and execute "software-properties-gtk" to change ‘trusty’ to ‘precise’ on the PPA and it worked great!

REFERENCES:

TV MAXE installation for Ubuntu

TV-MAXE is an application which provides the ability to watch TV stations and listen radio via different streams, like SopCast. Your ability to view certain streams may be limited by your current country, then again, you can always proxy through a country that will permit it.


sudo add-apt-repository ppa:venerix/pkg
sudo apt-get update
sudo apt-get install tv-maxe

REFERENCES:

Install Netflix on Ubuntu via Wine

UPDATE: (Sept. 2014) – Netflix will soon natively support Ubuntu, there are only a few small hurdles remaining, likely to be resolved by the NSS update expected in Ubuntu 14.10 (Utopic). A workaround is available for the impatient… http://www.omgubuntu.co.uk/2014/08/netflix-linux-html5-support-plugins.

For various reasons primarily related to DRM, there is not a native Ubuntu/Linux viewer for Netflix… this is one of the cases where WINE can help you out by providing (not emulating) a Windows environment.

These commands are for the Ubuntu setup, similar steps for other Linux distributions are available in the references.

I’ve found that it is better to pre-install the Wine Gecko and Wine Mono packages on Ubuntu.


sudo apt-get install wine-gecko
sudo apt-get install wine-mono

Then…

sudo apt-add-repository ppa:ehoover/compholio
sudo apt-get update
sudo apt-get install netflix-desktop

If you’ve never used WINE before within your Ubuntu/Linux environment, you’ll likely need to let it download the extensions for Windows, I believe that it will request to download and install the Gecko and Mono packages described above, click "Yes" if asked and all should go well!

REFERENCES:

Ubuntu fixing screen backlight brightness toggle

For quite some time, my primary Ubuntu laptop has had a problem with the keyboard keys used to adjust the screen brightness. This had been an annoyance on some of my travels where I’d wanted to extend battery life, as well as when I prefer to work in a darker space. I knew that it had to be a software driver issue of some sort, as it worked in my sometimes used dual boot Windows environment, but I’d never been bothered enough to look for a solution.

Truth is, it only took a minute or two to fix this!

  1. Modify the grub boot loader.
    sudo vi /etc/default/grub
  2. Change the line from:
    GRUB_CMDLINE_LINUX=""
    to
    GRUB_CMDLINE_LINUX="quiet splash acpi_osi=Linux acpi_backlight=vendor"
  3. Update the loader:
    sudo update-grub
  4. Reboot and you should be good to go!

REFERENCES:

Name based virtual hosting with Apache2 on Ubuntu

I often find it necessary to setup a temporary server for testing web applications. The easiest way to support this is often to create an integration (beta) test server that can be configured to support multiple hosts.

Initial Installation:

sudo apt-get install apache2
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo chmod 755 /var/www

To add a new site:

cd /etc/apache2/sites-available
sudo cp 000-default.conf yourdomain.com.conf
sudo vi yourdomain.com.conf
(change values as appropriate)
sudo chown -R YOURUSER:YOURGROUP yourdomain.com.conf
sudo mkdir -p /var/www/yourdomain.com
sudo chmod 755 /var/www
sudo vi /var/www/yourdomain.com/index.html
(add some fluff)
sudo chown -R YOURUSER:YOURGROUP /var/www/yourdomain.com
sudo a2ensite yourdomain.com
sudo service apache2 reload
sudo service apache2 restart

NOTE: replace YOURUSER and YOURGROUP with appropriate values for your server.

Install Plex Media Server on Ubuntu

You can find the latest release listed here and either download the file to your server directly or use the path to update the wget in the commands listed below…
https://plexapp.zendesk.com/hc/en-us/articles/201181647-Plex-Media-Server-Linux-nix-

Pre-requisite, you need to have avahi installed first or the script will later prompt you to do so…
sudo apt-get install avahi-daemon

i386 install:
wget -c downloads.plexapp.com/plex-media-server/0.9.8.18.290-11b7fdd/plexmediaserver_0.9.8.18.290-11b7fdd_i386.deb
sudo dpkg -i plexmediaserver_0.9.8.18.290-11b7fdd_i386.deb

amd64 install:
wget -c downloads.plexapp.com/plex-media-server/0.9.8.18.290-11b7fdd/plexmediaserver_0.9.8.18.290-11b7fdd_amd64.deb
sudo dpkg -i plexmediaserver_0.9.8.18.290-11b7fdd_amd64.deb

Then a series of commands, they should all be relatively straight forward. As the installer creates and runs the software under a user named ‘plex’, I create the user folders and change the default password in these steps… do what you are comfortable with!

sudo apt-get -f install
sudo mkdir /home/plex
sudo mkdir /home/plex/Music
sudo mkdir /home/plex/Videos
cd /home/plex
sudo chown plex * -R
sudo chmod 777 * -R
sudo passwd plex

Now you should be able to access the app with your browser, change the IP if you are not on localhost.
http://{ip}:32400/manage/index.html

WARNING: An installation using these steps could leave your server open to the general public, you
will want to password protect your server to secure any sensitive content, I’ll leave that for a separate topic.

REFERENCES:

Setup of Static IP addresses on Ubuntu

In these examples, I have used the OpenDNS servers, please change as appropriate.


sudo vi /etc/network/interfaces

Example contents:

auto l0 eth0
auto lo
iface lo inet loopback
iface eth0 inet static
address 10.1.10.xxx
netmask 255.255.255.0
network 10.1.10.0
broadcast 10.1.10.255
gateway 10.1.10.1
dns-nameservers 208.67.222.222 208.67.220.220
dns-search home


sudo vi /etc/resolv.conf

NOTE: I’m not 100% sure if this is required!
Add appropriate content, example:

nameserver 208.67.222.222
nameserver 208.67.220.220
search home

sudo restart networking
ifconfig
sudo ifdown eth0 && ifup eth0
sudo restart

REFERENCES:

Enable larger file uploads via Tomcat manager

Shortly after I automated code deployments in my Tomcat7 development testing environment, I found that some larger builds began failing with the following error:


org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (...) exceeds the configured maximum (62428800)

After a little digging, I found that the WAR files were exceeding the default maximum upload size, thankfully, this is trivial to increase.


sudo vi /usr/share/tomcat7-admin/manager/WEB-INF/web.xml

(Change 52428800 to a larger number, perhaps doubled like 104857600)

<multipart-config
<!-- 50MB max = 52428800 (100MB = 104857600) -->
<max-file-size>104857600</max-file-size>
<max-request-size>104857600</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>

REFERENCES: