Thursday, December 04, 2014

HOWTO Install the ownCloud Server on Mageia4

It appears that "the cloud" is the popular buzzword now. All cloud computing is is a remote file server where you can store, access, share and manipulate your files. While several commercial services are available, it's possible to create your own cloud service using the ownCloud software. As with any powerful server software, it's not out-of-the-box easy, but with some preparation and understanding, it's not that difficult. Most of this HOWTO is Mageia-specific; a lot of the configuration details are enumerated at the ownCloud website documents.

We're installing ownCloud on a minimal Mageia4 virtual machine using VirtualBox just to go through the process. There is no X-server, so it's all done on the command line.

Part One -- Installing the Apache Webserver

We must begin by installing the Apache webserver. It's certainly possible to use alternative webservers, but Apache is most common. Getting a working Apache webserver is pretty straightforward.

1. Install Apache and some other related modules we'll need. Eventually, you'll want to configure ownCloud to use SSL, so install that module now.

$ sudo urpmi apache apache-mod_ssl

Note that we don't install apache-mod_dav since ownCloud supplies its own DAV module.

2. Use drakconf on the command line and choose the selection that allows you to configure the firewall to allow the web server (and the ssh server for system administration via ssh).




3. Set inint to run the webserver on startup.

$ sudo chkconfig httpd on

4. Start the webserver.

$ sudo service httpd start

5. Check to see that the webserver is working by pointing you browser to the server IP.  I used the text-based lynx browser since there is no X-server on this machine.

$ lynx localhost

And it works!

Part Two - Install Useful Dependencies

Use urpmi to install the following apps. The ownCloud documentation explains why they are useful. You might as well do it now.

imagemagick
libreoffice-writer
php-exif
php-imagick
php-bz2
php-mcrypt
samba-client
davfs2
ffmpeg


Part Three - Install ownCloud

By default, the Mageia package installs ownCloud in /use/share. There's nothing wrong with that although some people prefer it to be someplace else and, with some care, you can move it wherever you like. What's important is that the user apache own all the files and directories associated with ownCloud. We do that by using:

$ sudo chown -R apache:apache /usr/share/owncloud

It's also necessary to provide an initial configuration file. The easiest way to do that is to copy the example they provide. That leaves us with a pristine example file to examine if we need.

$ sudo cp /usr/share/owncloud/config/config.sample.conf  /usr/usr/share/owncloud/config/config.conf 

When we run ownCloud the first time, it will strip out all the comments and fill in some of the values during its initial setup.

Part Four - Setup ownCloud

Before you access the admin part of ownCloud, you must be logging in from an authorized fully qualified domain name (FQDN). This is allowed by editing config.php to add your FQDN. If you are assigned a dynamic IP address, you must use a dynamic DNS service to get access; it's a security feature.

Once that is out of the way, access the admin pages by pointing your web browser to http://your.server.address/owncloud.

The complete configuration is actually a little more complicated that this and I'll be adding links to documents that provide details, but essentially this is what you need to to do to get ownCloud running on Mageia4. It's just not as simple as "urpmi owncloud".

NOTE: I've had some difficulty getting  ownCloud 6.x to run reliably, but Mageia has not yet updated their package to version 7.X. However, you can simply download the tar.bz2 package from the ownCloud site and replace the contents of /usr/share/owncloud.

Friday, October 10, 2014

Watching Netflix with Linux Without Ubuntu

Ubuntu has just announced that you can use Ubuntu to watch Netflix. They make it seem like Ubuntu is something unique and is the only way you can watch Netflix on Linux.

I use the Mageia disto of Linux, so that Ubuntu-specific mojo won't work for me.

Thankfully, it's not Ubuntu, but the beta version of the Chrome browser that has implemented DRM extensions for HTML5 video (along with a recent version of the NSS library, which Mageia has). All one need do is spoof the User agent in Chrome to make Netflix think it's serving the video on a Windows platform and you are watching Netflix!

1. Download and install Google Chrome beta from here.
2. Install the User-Agent Switcher from here.
3, Configure the User-Agent Switcher to spoof the user-agent as Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36 by adding it to the Chrome profile like this:



4. Log in to your Netflix account and enjoy the show.
5. No Ubuntu needed, just thank Nathan VanCamp.

Monday, August 04, 2014

Configuring a Headless Transmission Torrent Server for Mageia4

This will describe how to install and configure the Transmission torrent application on Mageia 4 in a headless configuration, how to make it automatically download torrents by placing a .torrent file in a particular directory and admin the client remotely using both a cli (command line interface) and a GUI (graphical user interface) application.

Transmission has both a Homepage,  a Wiki and a Forum, so there's no lack of help and support. But as for installing it as a headless server on Mageia, all we found were HOWTOs for Debian/Ubuntu systems.


We're assuming that you have Mageia4 installed and have configured your user to use the sudo command.


INSTALL
Begin by installing the transmission daemon and the command-line client.

$ sudo urpmi transmission-daemon transmission-cli

This installs  transmission-daemon, transmission-cli and transmission-common (which is mostly the documentation). All the binaries will be found in /usr/bin. The transmission package also installs a Java-based web client at /usr/share/transmission/web/index.html.

CREATE A USER
For transmission-daemon, all settings are kept in $HOME/.config/transmission-daemon. We want to create a user named "transmission". Other distros make the "home" directory something like /usr/share/transmission or /var/lib/transmission; it can really be anything you want. For us, creating /home/transmission has a special benefit.

$ sudo adduser transmission
$ sudo passwd transmission


Having a password allows us to use scp to remotely send a .torrent file to /home/transmission/ on our remote server and the torrent will automatically start when we have properly configured the transmission-daemon to do so.

OBTAIN AN INIT.D SCRIPT
There is an Debian/ubuntu-specific init.d script available from the Transmission site, but it won't work for RedHat-derived distros like Mageia.

We can download an init.d script useful for RHEL and Fedora (and Mageia) written by Jason Friedlan. It's located at his website; you'll need to copy and paste it into a text editor.

We'll need to make some changes for Mageia:

- TRANSMISSION_HOME=/var/lib/transmission
+ TRANSMISSION_HOME=/home/transmission


Save the script as transmission-daemon, change the ownership to root and make it executable, then move it it /etc/init.d.

$ sudo chown root:root transmission-daemon
$ sudo chmod +x transmission-daemon
$ sudo mv transmission-daemon /etc/init.d/

To verify that our script is valid for init.d invoke:

$ sduo chkconfig --add transmission-daemon

Now set the runlevels for transmission-daemon with:

$ sudo chkconfig --level 345 transmission-daemon on

and verify it with:

$ sudo chkconfig --list transmission-daemon

CREATE THE BASIC FILES
Now that our service is configured, let's start and stop the daemon to make certain it works.

$ sudo service transmission-daemon start
$ sudo service transmission-daemon stop


Then invoke:

$ sudo ls -al /home/transmission

This will reveal that the .config directory has been created and we will find that /home/transmission/.config/transmission/settings.json has also been created.

CONFIGURE TRANSMISSION
The editable text file settings.json contains the default configuration for our daemon. It can be edited with a text editor and an explanation of the various options can be found at the Transmission Wiki.

Some suggested changes are (the trailing commas are important!):

Add a blocklist:
- "blocklist-url": "http://www.example.com/blocklist",
+ "blocklist-url": "http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz",


Allow all users on the network to access the web interface:
- "rpc-whitelist": "127.0.0.1",.
- "rpc-whitelist-enabled": true,.

+ "rpc-whitelist": "*.*.*.*",
+ "rpc-whitelist-enabled": false,






Save the file and restart the service.

Setting a username and password to stop all users but us is important, but this must be done with the transmission-remote command because the password is hashed for security and not stored as plain-text.
$ su - transmission
$ transmission-remote --auth username:password


You can use transmission-remote to change any of the settings; look at the man page for details or at the Wiki page.

You'll need to set the home directory to auto-download any torrents. First, we'll need to enable it, then set the directory. As shown here, we'll do it on one line each:
$ su - transmission -c transmission-remote --watch-dir-enabled true
$ su - transmission -c transmission-remote --watch-dir /home/transmission


And, we'll have it keep downloaded torrents in /home/transmission/Downloads.
$ su - transmission  -c transmission-remote download-dir /home/transmission/Downloads

If you don't change a setting, transmission will use the default setting. You can see the default setting by examining the settings.json file or looking at the Wiki page referenced just above.

If you are GUI-centric and command-line-phobic, install the GTK or QT clients and as the user "transmission" use the transmission client GUI to change the settings. That's pretty easy.

NOW START TRANSMISSION
 $sudo service transmission-daemon start

  And you are ready to use it.

START TORRENTS AUTOMATICALLY

Instead of clicking on a torrent link, save the link instead and move it to the torrent user.

$sudo mv *.torrent /home/torrent/

Now the download starts automatically! You can even do this from a remote computer, so if your server is at home and you are at work, just copy the .torrent file over the Internet and the download will be done by the time you get home.

To admin your Transmission server, there's the provided Java web client, or a stand-alone application called

FEEDBACK
As always, I'd appreciate any feedback, especially if I made any errors in this.

Tuesday, May 27, 2014

Keep Updating Windows XP until 2019

Microsoft ended support for WindowsXP on April 8th of 2014. But they will continue to support the Point Of Sale version of WindowsXP, known as Windows Embedded POSReady 2009, for five more years.

To receive these updates for your WindowsXP computer, you need to alter a registry entry to fool the Microsoft Update server into thinking that you are using Windows Embedded POSReady 2009.

Here is a .reg file that looks like this if you view it in a text editor:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\WPA\PosReady]
"Installed"=dword:00000001

Download and double-click on the .reg file, then just run Windows Update as usual.

Not all the available updates are useful for you; there's no need to select the updates for Windows Server 2003, for example. However, even if you do they will just fail to install. This means that Automatic Update will continue to work as before until 2019 (You do have that turned on, right?) and Microsoft Security Essentials will continue to update (you do have that installed, right?). You should be ready for a new computer by 2019 anyway.

If you have a 64-bit Windows XP installation, look here for the appropriate instructions.

One last note. It's not likely that any of the future updates of Windows Embedded POSReady 2009 will update the Internet Explorer web browser and newer version of the browser are not compatible with WindowsXP. Sadly for all of us, Internet Explorer is the target (or the vector) of most all of the malware attacks. Here's how to protect yourself: DO NOT UNDER ANY CIRCUMSTANCES CONTINUE TO USE INTERNET EXPLORER. Replace it with the most recent edition of the Firefox browser and install the AdBlock extension. Most malware nowadays is installed through Internet Explorer via malicious ads that you are completely unaware of.

There are also attack vectors through Microsoft Office. A free and capable alternative is LibreOffice.

An excellent free and capable email application and alternative to Outlook Express is Thunderbird.

I also highly recommend three additional programs for Windows XP:

Piriform's CCleaner to clean up unnecessary files on your drive, since Windows loves lot's of free space on the drive and doesn't work well when you fill up more than about 2/3 of the disk. Internet Explore leaves a lot of useless files that never seem to get deleted. Get the Free Download version and DO NOT install any toolbars when prompted.

Piriform's Defraggler to defragment your drive after you clean it up, since Windows loves a defragmented drive. Get the Free Download version and DO NOT install any toolbars if prompted.

The free Microsoft utility Page Defrag. This authentic Microsoft utility will defrag the special system files that a regular defrag application like Defraggler can't touch. You only need to run this once in a while.

Try them all; you'll be a happier WindowsXP user.


Saturday, February 08, 2014

The first release of Mageia 4 is out.



The first release of Mageia 4 is out. You can download it from here and read the release notes here.



If you've used Mandriva Linux, you'll feel right at home with Mageia. Mageia has quickly established a reputation of working well for both the novice user and the power user. Installation is typically easy and hardware support is among the best of any distro. The user and administrative tools are comprehensive and easy to use. Of course, under the hood, it's all Linux and all configuration files are plain text files and all a competent administrator needs do is to choose a shell and a text editor.

If you've used Red Hat or Fedora, the differences with Mageia are examined here.

Just like Mandriva, Mageia is known for excellent default fully-featured configurations of the KDE4, GNOME2, LXDE and other desktop environments as well as a broad range of available applications.

For the average user, the changes in Mageia4 are mostly cosmetic. The Mageia art, colors and graphics are very well done (and contributed by the Mageia user community). But if it's just a pretty Mandriva or prettier Magia3, why is there a need for a newer Mageia distro?

These changes are mostly "under the hood", but are done to keep pace with improvements in technology and compatibility with standards and interoperability.
Most tools have been ported to Gtk+-3which will allow the use of the Broadway technology. For improved security, all admin tools have been ported from to polkit when needing root privileges. Mageia 4 still comes with GRUB as a default but also provides GRUB2 for forward compatibility. For GNOME2 fans, the MATE desktop is available; it is a updated version of GNOME2. All software packages are the most recent stable versions (a few are stable beta releases).


Mageia began life as Mandriva. Mandriva began life as Mandrake Linux, based on Red Hat 5.2; Mandrake was essentially "Red Hat Done Better". It offered a well-configured KDE as the default desktop as well as its own administrative tools that provided more flexibility than those tools offered by Red Hat. The under-the-hood difference in these tools was that they were (and continue to be) written in perl language rather than the python language as used by Red Hat. Mandrake/Mandriva also spent considerable effort on its unique urpmi package management tool, essentially an intelligent, powerful console/gui wrapper around the RPM system of package management.


At some point, the business management of Mandrake/Mandriva lost its way, rallied, re-grouped and then lost its way again. The first time, they lost focus on Linux and the second time, they lost focus on their community. Mageia stepped in to fill the void in the community so that all the good things that were represented by the Mandriva distro would not be lost in the corporate buyout.


Which is why the software is so similar and the community is so different; you only need to fix what is broken.


Mageia4 offers the most recent version of your favorite application software and all the major software you expect to be there is there.

Both 32-bit and 64-bit installation DVDs as well as a Live CD are available. Migration from existing Mageia3 installations is easily done. A large on-line software repository is available and provides a wide range of software of both free licensed and other licensed  categories (the latter is not enabled by default, but is opt-in). Third-party Repositories are also available.

As with any initial release, you're likely to find a few minor bugs, but the Mageia community is there to help you. As a long-time user of Mandrake/Mandriva and co-author with Bill Ball of the Red Hat/Fedora Unleashed series, I believe you'll find Mageia a full-featured and easy-to-use Linux distro.

A guide to update from Mageia 3 can be found here.

A Faster System

I'm always looking for ways to speed up my computer, especially when it comes to the boot process and loading applications. A good overall discussion or improving system performance is at https://wiki.archlinux.org/index.php/Maximizing_Performance, just remember that it focuses on the ArchLinux distro, not the Mandriva distro I use.


READAHEAD
A useful utility is readahead. According to its manpage, readahead populates the page cache with data from a file so that subsequent reads from that file will not block on disk I/O. On my Mandriva 2101.2 system, the default installation of readahead places a default file at /var/lib/readahead/default.early. To create custom files based on your system, you should reboot the system and pause the GRUB menu and add the following to the command line.

init=/sbin/readahead-collector

This will examine your system as it boots and create a list of what files are to be loaded in the order that they are loaded.

The configuration file is found at /etc/readahead.conf and this is where you can turn on debugging if you're experiencing problems and can add excluded directories.

PRELINK
Next is the prelink utility. According to the man page, prelink is a program that modifies ELF shared libraries and ELF dynamically linked binaries in such a way that the time needed for the dynamic linker to perform relocations at startup significantly decreases. Due to fewer relocations, the run-time memory consumption decreases as well (especially the number of un-sharable pages).

The file /etc/prelink.conf contains a list of files and directories that prelink uses to determine where it should look and what files to avoid. Prepending -l (or -h if on a networked filesystem) to a path makes prelink search that directory for ELF binaries or shared libraries. You can prepend -b to blacklist a directory or a file to avoid which will speed up the search or deliberately avoid prelinking certain binaries.

Mandriva provides a directory to keep your customizations separate at /etc/prelink.conf.d/; just create a file there ending in .conf and your customizations will be included. The general invocation is

# prelink -a

Upgrade Mageia 2 or Mageia3 to Mageia 4

Back in the early days of Linux, the changes to the OS were so dramatic that even when updating withing the same distro, in-place point release updates were problematic enough and it was always recommended that a major version release be done from scratch. There were just too many major changes to the underlying subsystems and package naming conventions. Doing an in-place update was just asking for trouble.

Modern distros have matured quite a bit although there are occasionally some major subsystem changes being made. Yet it's never been easier to do an in-pace major version upgrade.

I just did the upgrade on several Mageia3 systems and the results were consistent and satisfactory, not to mention simple.

Step 0.

Always backup critical information. Have a Mageia3 recovery disc on hand.

From GUI

Step 1.

$ sudo mgaapplet-upgrade-helper --new_distro_version=4

Done.


From CLI

Step 1.

Fully update the packages you now have installed.

$ sudo urpmi --auto-update --auto -v


Step 2.

Remove all the existing Mageia4 repositories.

$ sudo urpmi.removemedia -av

Step 3.

Add the Mageia4 repositories. (All on one line.)

$ sudo urpmi.addmedia --distrib --mirrorlist 'http://mirrors.mageia.org/api/mageia.4.i586.list'

Step 4.

Update the packages

$ sudo urpmi --replacefiles --auto-update --auto -v

Step 5.

Reboot. You'll be using a new kernel, new glibc and so on.

$ sudo shutdown -r now

Step 6.

Run the package update command again. It should return with no packages needing updating.

Done.  But . . . .

Do Some Checking.

$ cat /etc/redhat-release
$ cat /etc/issue

Those commands should return the information that you are running Mageia4. I did have an issue on one machine and $ sudo urpmi mageia-release-common fixed it. You can also edit these files to change the version number.