Ceci est une ancienne révision du document !
One of our Computer Recycling volunteers has been pining for some intellectual stimulation a bit different from our usual assemble/disassemble/troubleshoot PCs. The volunteer had picked up a book on Linux System Administration - hoping to learn more about managing systems. It's a bit beyond the scope of what we typically do, but after thinking about it for a bit, I figured it could help the person open up some new opportunities. The workstation the volunteer often sat at runs Windows 10. Although we could have set up a complete development environment and virtual server within Windows 10, the individual wanted to work in Linux, so we set up a dual-boot environment.
At first, we'd planned on installing Linux Mint 18.2 (I'd previously made a multi-boot USB key using the Windows version of the YUMI tool), but Linux Mint couldn't see the hard drive, it detected only the USB key. My second instinct was to try Kubuntu (because we're used to Xubuntu, and it's sometimes nice to investigate a different set of software), but Kubuntu seemed to freeze booting from the key. Unity has never been my favourite desktop environment, but, to the surprise of both of us, it ran very well on the machine, and had no issues detecting and partitioning the hard drive - in fact it was one of the smoothest installations I've done in awhile.
The hardware: • Gigabyte Z68P-DS3 motherboard • Intel Core i5-2400 CPU (4 cores) • 4GB DDR3 RAM • 400GB Western Digital WD4000AAKS-0 • NVidia Quadro FX580 (512MB) video card • Dell SP2309W 23“ LCD Monitor running at 2048×1152
Hardly impressive by today's standards, but considering we still build Core 2 Duo and Core 2 Quad systems, it's got a bit more power than some of the systems we still use in Computer Recycling.
After Ubuntu installed, we installed all the updates, the proprietary NVidia driver, and set up a non-administrative account for the volunteer. Next, we downloaded an ISO of Ubuntu Server and installed Virtualbox.
At this point, I encouraged the volunteer to get a notebook for us to write down the usernames and passwords for all the accounts we'd set up and were about to set up. We jotted down the volunteer login for the Ubuntu desktop environment, then we proceeded to install Ubuntu server in Virtualbox.
One of the adjustments we made was to set up the server's network adapter in “bridged” mode. In bridged mode, we'd be able to access the Ubuntu server session from the same subnet. We gave the server a name, and jotted down the administrative username and password (for the server, not the desktop). During the server setup, we chose to install SSH, but not LAMP. We could have installed LAMP, but I knew installing afterwords is a simple matter of running tasksel again. As it turns out, that was a good idea because, on first try, we couldn't SSH into the server, this was when we discovered we needed to set the network adapter to bridged mode.
Next, we updated the server software; this proved to be a bit more challenging since the network we're on has a captive portal page. For those who don't know, a captive portal page is a sign-on page that prevents access to a network (Internet in this case) until a person performs some action dictated by the page (in our case entering a username and password). On the desktop, this isn't an issue; we simply open Firefox, load the page, and sign on. On Ubuntu server, it's a bit more of an issue since we had no browser installed. So, for a brief moment, I added the server to a network without a captive portal so we could download w3m (a text-based browser). Then I plugged the system back into the captive-portal enabled network. To simplify logging into the captive portal page, I wrote a very simple bash script:
#!/bin/bash
The portal page URL is rather complex, and while the volunteer could have typed w3m http://portalpage/ (the URL was really much longer), it seemed easier to just type something like ./portal.sh (the bash script name). The script was a success and we were able to get past the portal page, but one of the gotchas of w3m is having to press ENTER to get into and exit each field (username and password).
After this, we ran updates on the server and installed the LAMP stack using tasksel. During the LAMP installation, we wrote down the mysql root password. Over the virtual server, we wanted to give the volunteer complete control. We also exported the server appliance so the volunteer could eventually work on the same server environment on another machine if they chose. Exporting the server also provided a kind of backup for the server if it got messed up (though we also snapshotted and cloned the server appliance). Of course, until that appliance is moved to another drive, it's not a real backup.
Back on the desktop computer, we installed Atom for editing code and Filezilla for transferring files. At this point, we had a brief discussion about permissions and the location of the default index.html on Apache. I'm used to using vi for small edits - I haven't actually used Atom - but it seems to be well liked.
At this point the volunteer is practising SSHing into the server and executing simple *NIX commands: cd, cp, ls, pwd, less. We had a look at the default Apache web page, modified the index.html, moved it to another file, and created an index.php with the phpinfo() function to show PHP was working on the server.
The following day we sat down and reviewed logging in to MySQL and running a few commands against a sample employees database you can download from the MySQL web site: https://dev.mysql.com/doc/employee/en/. Introducing MySQL at this point was probably a bit too much for the volunteer because, when I left and came back from lunch, I found the volunteer at a bash prompt trying commands, but failing because they didn’t include spaces between commands and their arguments.
It's a start, but we probably need to create some visuals to help understand everything that's going on. I’m not a programmer, database expert, nor scripting expert, but one of the things I love about Linux is that, with a bit of looking around (and some help from a mentor), anyone can learn a bit about running a server, learning to program, or working with databases.