Areas of Interest, as counted by my cat

Category: Linux (Page 1 of 2)

SQL Server 2017 on Linux Mint

I followed the instructions as laid out here:

My target was a VM instance of Linux Mint 18.3, called “golem”. Everything just works… SQL Server is running automatically after I boot the VM.

Some other links I need to review:

Interestingly, the database properties don’t seem to know about the Linux host:

image

Installing Oracle’s JDK in Ubuntu Linux

Just for my own notes, because I can never remember this stuff.

1. Check the architecture of your host:

colin@Mongpy:~$ uname -m
x86_64

2. Grab the appropriate download from Oracle’s web site:

image

My web browser puts it in the Downloads folder under home.

colin@Mongpy:~$ ls -l ~/Downloads
total 393356
drwxr-sr-x 7 colin colin 4096 Mar 31 12:21 eclipse-installer
-rw-rw-r-- 1 colin colin 185540433 May 25 13:19 jdk-8u131-linux-x64.tar.gz
-rw-rw-r-- 1 colin colin 21944320 Mar 29 14:18 mysql-workbench-community-6.3.9-1ubuntu16.10-amd64.deb
-rw-rw-r-- 1 colin colin 195297254 May 25 12:47 pycharm-community-2017.1.3.tar.gz

3. Open a terminal and get superuser access:

colin@Mongpy:~$ sudo su
[sudo] password for colin:
root@Mongpy:/home/colin#

4. Make a directory and expand the archive:

root@Mongpy:/home/colin# mkdir /opt/jdk
root@Mongpy:/home/colin# tar -zxf ./Downloads/jdk-8u131-linux-x64.tar.gz -C /opt/jdk
root@Mongpy:/home/colin# ls -l /opt/jdk
total 4
drwxr-xr-x 8 uucp 143 4096 Mar 15 01:35 jdk1.8.0_131

5. Review the current default JDK:

root@Mongpy:~# update-alternatives --display java
java - auto mode
link best version is /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
link currently points to /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
link java is /usr/bin/java
slave java.1.gz is /usr/share/man/man1/java.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz

root@Mongpy:~# update-alternatives --display javac
javac - auto mode
link best version is /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
link currently points to /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
link javac is /usr/bin/javac
slave javac.1.gz is /usr/share/man/man1/javac.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/bin/javac - priority 1081
slave javac.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz

Note the current “priority” is 1081.

6. Set the Oracle version as the default JDK, using a higher priority, say 1090:

root@Mongpy:/home/colin# update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_131/bin/java 1090

update-alternatives: using /opt/jdk/jdk1.8.0_131/bin/java to provide /usr/bin/java (java) in auto mode

root@Mongpy:/home/colin# update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_131/bin/javac 1090

update-alternatives: using /opt/jdk/jdk1.8.0_131/bin/javac to provide /usr/bin/javac (javac) in auto mode

root@Mongpy:/home/colin# update-alternatives --display java
java - auto mode
link best version is /opt/jdk/jdk1.8.0_131/bin/java
link currently points to /opt/jdk/jdk1.8.0_131/bin/java
link java is /usr/bin/java
slave java.1.gz is /usr/share/man/man1/java.1.gz
/opt/jdk/jdk1.8.0_131/bin/java - priority 1090
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz

root@Mongpy:/home/colin# update-alternatives --display javac
javac - auto mode
link best version is /opt/jdk/jdk1.8.0_131/bin/javac
link currently points to /opt/jdk/jdk1.8.0_131/bin/javac
link javac is /usr/bin/javac
slave javac.1.gz is /usr/share/man/man1/javac.1.gz
/opt/jdk/jdk1.8.0_131/bin/javac - priority 1090
/usr/lib/jvm/java-8-openjdk-amd64/bin/javac - priority 1081
slave javac.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz

7. Finally, testing:

colin@Mongpy:~$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Cool.

Setting up a LAMP test environment

Not my usual kind of thing, but a possible new client meant preparing a system to stand up a replica of their production environment. These are my notes.

I started by downloading an .iso of ubuntu-12.04-server and deploying it to a new VM.

Critical things to remember:

  • Set up two network adapters in the virtual machine config: NAT, and Host-only networking, as per my notes documented elsewhere;
  • select [X] LAMP server during the deployment to give it Apache/MySQL/PHP in one hit, at startup;
  • install ssh so you can remote into it
$ sudo apt-get install openssh-server openssh-client

Checking for installed status:

$ which php
/usr/bin/php

$ sudo service apache2 status
[sudo] password for colin: ****
Apache2 is running (pid 1107).

$ mysql -u root -p
Enter password: ****
..
mysql>

By default, the Apache web server document root folder appears to be:

$ ls -l /var/www
total 4
-rw-r--r-- 1 root root 177 Dec 6 12:10 index.html
$

Allowing connections to MySQL from outside the server

Edit /etc/mysql/my.conf:

Comment out the line:

#bind-address    = 127.0.0.1

Run the following SQL(might not be required, note the 0 rows affected):

mysql> grant all privileges on *.* to 'root'@'%' identified by '****' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Restart the DB:

$ sudo service mysql stop
mysql stop/waiting

$ sudo service mysql start
mysql start/running, process 1578

And, importantly, test from outside (in my case, my host operating system):

C:\Program Files\MySQL\MySQL Server 5.5\bin> mysql -h 192.168.56.56 -u root -p
Enter password: ****
...
mysql>

In MySQL Workbench:

image

Cool.

Installing FTP server

Just in case we need to move files in and out of the test environment (which we almost certainly will need to do), we’ll set up an FTP server. The most suggested option seems to be something called vsftpd:

Reference: https://www.liquidweb.com/kb/how-to-install-and-configure-vsftpd-on-ubuntu-12-04-lts/

When I tried this, I got an error:

$ sudo apt-get install vsftpd
[sudo] password for colin: ***
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package vsftpd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'vsftpd' has no installation candidate

Long story short, the following sequence of instructions worked for me:

1. un-comment the extras.ubuntu.com repositories in /etc/apt/sources.list:

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main

2. Remove old information, and update:

$ sudo rm -rf /var/lib/apt/lists/*
$ sudo apt-get update

3. try installing again:

$ sudo apt-get install vsftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
vsftpd
0 upgraded, 1 newly installed, 0 to remove and 129 not upgraded.
Need to get 124 kB of archives.
After this operation, 342 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main vsftpd amd64 2.3.5-1ubuntu2 [124 kB]
Fetched 124 kB in 1s (91.2 kB/s)
Preconfiguring packages ...
Selecting previously unselected package vsftpd.
(Reading database ... 53560 files and directories currently installed.)
Unpacking vsftpd (from .../vsftpd_2.3.5-1ubuntu2_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up vsftpd (2.3.5-1ubuntu2) ...
vsftpd start/running, process 2229
$

Thank goodness for that!

Some configuration required in /etc/vsftpd.conf, see:

basically

write_enable=YES
local_umask=022

Restart:

$ sudo service vsftpd restart
vsftpd stop/waiting
vsftpd start/running, process 2462
$

Now, testing from the Windows host:

C:\PROGRA~2\WinSCP>WinSCP
winscp> open 192.168.56.56
Searching for host...
Connecting to host...
Authenticating...
Username: colin
Password: ****
Authenticated.
Starting the session...
Session started.
Active session: [1] 192.168.56.56
winscp>

OK, I think it is all ready for us to unpack that archive we got from the client and see about deploying into the test environment.

iMac; Linux; GRUB; OS X: Can’t we all just get along?

I’m not really a fan of OS X. I’m sure the underlying OS is fine – after all, It’s a Unix system. I know this! – but the Finder; the keyboard layout; the relentless updates; but most of all the fuzzy text aggravated me.

After some success with a Bootable USB drive containing a 64-bit Linux Mint ISO, I decided to follow Clem’s excellent instructions here:

http://community.linuxmint.com/tutorial/view/1643

and install Linux Mint 17.1 on my 2013 iMac.

Now, I’m not crazy: I resized the primary OS X partition and divided up the remaining space, just as Clem recommended:

/dev/sda4    30 GB   ext4
/dev/sda5     4 GB   swap
/dev/sda6   500 GB   ext4 

After the Linux install completed, I also followed the “Fixing the boot order” instructions, about installing efibootmgr and making the EFI boot Linux first. Supposedly this was to achieve:

“The boot order should now indicate that it will run Mint first, and if that ever came to fail.. it would then run Mac OS. In other words our MacBook now boots into Grub. From there we can select Mint or press Escape and type “exit” to boot into Mac (we’ll fix the Mac grub entries to make it exit without having to type anything later on in this tutorial).”

I’m not sure what I did wrong… maybe nothing. Maybe we’re just expected to have a complete understanding of EFI and GRUB and bootloader configuration in general, at this point.

Anyway, bottom line: I never saw GRUB, or a menu of boot options, or anything. It just booted straight into Linux. Fortunately the Mac HD volume is visible and accessible under Linux, and I’ve been able to copy my files over as the need arises, from inside Linux Mint. Excellent.

But what if I want to execute a Mac OS X application natively, for some reason? Dammit, I want to dual boot this thing. The normal Option- key (Mac Boot menu) no longer works, and neither does Option-R (to get to the Mac Recovery partition).

After some research, I learned that pressing ‘c’ during the boot process gets us to the GRUB command line. Now I could use the ls -l command to list the partitions:

hd2,gpt1      fat efi
hd2,gpt2 hfsplus 'Mac HD'
hd2,gpt3 hfsplus 'Recovery HD'
hd2,gpt4 ext * 29 GiB
hd2,gpt5 - 5 GiB
hd2,gpt6 ext * 438 GiB

but this still left me with no understand of how to boot into one of them. More research:

http://askubuntu.com/questions/16042/how-to-get-to-the-grub-menu-at-boot-time

OK, so I learn about GRUB 2 and the significance of the /etc/grub.d scripts and the /etc/default/grub file, and commenting out the GRUB_HIDDEN_TIMEOUT=0 setting by prefixing it with ‘#’.

Dedoimedo has a really nice tutorial on GRUB here:

That taught me how any changes to these grub config files should be followed up with:

$ sudo update-grub

After that, when I restart, I get the boot menu! Yay. From the partition list (see above) I’m pretty sure that I should be able to add a menu option for the OS X partition.

More research:

http://askubuntu.com/questions/179689/mac-os-x-wont-boot-from-grub-menu-in-ubuntu-precise-on-apple-mba5-2

It suggests adding the following to the /etc/grub.d/40_custom script:

   menuentry "OS X" {
insmod hfsplus
set root=(hd1,gpt2)
chainloader /System/Library/CoreServices/boot.efi
}

Long story short: that works perfectly. After sudo update-grub and a reboot, we have a menu and an option that will boot into OS X.

Thanks, Internet!

“Because it’s there” may not be a good reason

I'm seriously thinking about going back to Windows XP on my little laptop here. For two reasons:

1. Ubuntu 9.04 / Gnome appears to run sluggishly. Is it the EXT4 file system? Is it some optimization I haven't discovered? I have no idea. Since part of the reason of giving Linux a go was to experience a lean, mean OS with no cruft, it seems just wrong to me. 

2. I'm not really having much fun. I thought it would be fun to dabble and learn and maybe even get MonoDevelop and ASP.NET working. Well it's not fun at all. It's tedious. There is much that I don't understand and what little time I have left over for this kind of activity is spent trying to find exactly the right blog post that explains something.

I want my comfort zone back.

Ubuntu Diary – Thunderbird 2 + Lightning 0.9

OK, so I installed the Lightning 0.9 add-on to Thunderbird in order to have Calender functionality, and I didn't notice until yesterday that I can't actually add any events to the calendar! The buttons and menu options are disabled.

This evening some quick googling turned up this reference to Bug# 278853 which is actually misleading because this isn't a bug in Thunderbird at all, but a dependency of Lightning 0.8 and 0.9 on a library that isn't installed on Ubuntu 9.4 by default.

Solution:

  • Uninstall Lightning 0.9 from Thunderbird's add-on dialog;
  • Go to Synaptic Package manager and search for "libstdc" and select to add the libstdc++5 package and apply changes;
  • Re-install Lightning 0.9

Result: I can now add an event to my calender reminding me to record the show "Being Human" on BBC America on the evening of July 25th.

Ubuntu Diary – Day 7

Web Camera

My Sony Vaio FE790G has a built-in web cam, a "Motion Eye" lens located in the top edge of the LCD screen border. Last time I tried Ubuntu, in 8.10, I couldn't get it recognised, but the truth is I didn't do much research and I probably didn't expect it to work. I know that in Windows XP, I needed to install special Sony-provided driver.

This time around, given that I am trying to get as deep into the Ubuntu/Linux world as possible, I did some googling, and found this very lengthy and comprehensive thread from other users of Sony Vaios with Motion Eye web cams. It seems that was was needed was something called a "gspcav" driver.

I actually got as far as downloading the driver source code and attempting to compile it (failed) before I thought to ask Ubuntu/Linux whether the driver was already installed:

    $  modprobe -l | grep gspca
 

This command seems to indicate that this is already present on the system. But how to activate the camera? I tried running Gimp and creating a new image from a scanned source, and some intermediate helper application called xsane popped up and allowed me to "scan" from the camera. The results were not encouraging:

That's me holding up my hand in front of the camera, but you can see my Escher print in the background. Do the three copies of the image represent RGB scans? Is this because the xsane program thinks it is talking to a flatbed scanner? I have no idea, but clearly there is a possibility that I can get the webcam to work. More on this as I get around to it, as having a working web camera is not the highest priority right now.

Printing

"It just works" almost applies. My traditional default printer is a Minolta/QMS Magicolor 2350 EN Laser printer, networked on the LAN. I turned it on and went to System > Administration > Printing. Click on the New toolbar button, and up comes the New Printer dialog, giving me a list of two choices: "Other" or "Network Printer". When I clicked on Network Printer, the list expanded to show an addition entry: "Minolta-QMS magicolor 2350 192.168.100.3". The Location host and port parameters were already filled out with 192.168.100.3 and 9100 respectively. Very cool.

I clicked Next and saw briefly "Searching for drivers…", then "Searching for downloadable drivers…", then a new dialog, "Choose Driver". This gave me three options: Select printer from database; Provide PPD file; Search for a printer driver to download. Always the optimist, I selected Select printer from database. The comprehensive manufacturer list contained three possible choices: KONICA MINOLTA; Minolta; and QMS. I tried each of them, and the closest I could get to was Minolta > magicolor 2300 DL. I tried this, and long story short, it didn't work. (I would have been very surprised if it did.) My test page was rendered as a few garbage characters at the top of what could have been a vast number sheets of paper, had I not switched the printer off.

I tried the third option, Search for a printer driver to download. This appeared to be searching the same database as the first option because I could not find a better match from the results. Time to try google to see if I could find a .PPD file for the printer. I can't remember what search terms I used but it can't have been 10 seconds before I got to this gem:

http://www.openprinting.org/show_printer.cgi?recnum=KONICA_MINOLTA-Magicolor_2350

This led me to download 2350lin_ppds.tar.gz, which contained a bunch of language folders, and inside the English folder was KM2350NP.ppd, which allowed me to select the Provide PPD file option. This worked perfectly. I can now print from applications, in duplex too.

This was no harder than searching for printer drivers in Window XP, in some ways easier, particularly in cases where you don't have a CD from the printer manufacturer stuffed with drivers for your convenience.

Ubuntu Diary – Day 3

I plugged my camera into a spare USB port, and waited. It just works… Ubuntu recognised the attached storage and prompted me for an application. I chose F-Spot Photo Manager because it seemed like the right thing to do, and successfully copied the images to the filesystem. That is a complete success, in my book, except for the following issues:

  • I'd created a folder ~/pictures/camera but for some reason I could not copy the images from the camera to that location. I ended up putting them in ~/pictures instead, and then moving them manually later.
  • By default Ubuntu apparently created a directory called ~/Photos for me but I swear I don't remember seeing it before. Did F-Spot do this, or am I just blind? [Update: The directory was created last night, so I expect F-Spot did it, or perhaps Ubuntu did after it recognised the camera.]
  • I couldn't figure out how to move the images from the camera (thus relieving me of the need to delete them from the camera in a separate operation).

(The camera is a FujiFilm FinePix 602z. The laptop is a Sony Vaio FE790G.)

Ubuntu Diary – Day 2

I have Windows XP running in a Virtual Box 2.2 virtual machine now. I gave it 950 MB of RAM, very smooth now that the VirutalBox Machine Additions are installed. Seemless Mode is mindblowing the first time you see it – that's where you have Windows XP applictions floating in the Ubuntu desktop with no container window. For now I have it set back to "normal" mode. Both it and the host Ubuntu OS seem to be getting their IP addresses via DHCP, I never had to specify an IP although I had some all ready to assign to them. I suspect that static IPs will be required at some point…

This blog website looked a little weird in Ubuntu until I installed the Microsoft Core TrueType fonts for Linux. I should do something about that at some point, I guess. On the other hand, I'm not ashamed that my heritage is Windows, so for now, it can stay the way it is.

The Flash plugin isn't installed by default but it was very straightforward to install. I just followed the "Click here to install" link and it worked. Quicktime was almost as easy – it seems that there is a plugin registered to Quicktime but it needs some codecs, but again, it prompts you for the installation and after a few minutes, it just works. Great.

Now, I have all my Windows documents, etc, backed up on to our NAS drive, and although Ubuntu found the network resource and let me browse it (it helps to use the same username/password for every device on the LAN), it seems that many Ubuntu/Gnome applications won't load files from network drives. The "Open File" dialog will allow you to go there and select a file, but it doesn't seem to take effect. Two examples: Restoring my Firefox bookmarks from a .JSON  backup – I needed to copy the .json file into my home directory on the local filesystem before it worked. Also, copying some truetype fonts in to the /usr/share/fonts folder: I was running the File Browser as root, but it still wouldn't let me drag and drop from the network drive. I had to copy the ttf files to a local temp path, and drag and drop from there.

Speaking of the Linkstation network drive, the Windows VM could see it, no problem. Again – I'm using the same username/password for the Windows login. I realise as I write this that I haven't verified that Windows applications can read and write files on the Linux filesystem, but if VirtualBox is anything like VMWare's software, I'm sure there is a way to set up a shared folder and mount it in Windows Explorer.

Ubuntu Again

This post is being written from inside Firefox runing on Ubuntu 9.04.I repartioned the disk into one single EXT4 partition – Windows XP has gone, but the plan is to bring it back via a virtual machine in Virtual Box.

I backed up all my files to our handy network attached storage, a Buffalo LinkStation 250 GB, and I've confirmed that I can access the files from Ubuntu, without any additional configuration. It just scanned the network, it showed up as an icon, and I double-clicked on it and entered my username and password (nothing different about that). It just works. Very cool.

I see the update Manager has just notified me that there are updates. I suppose I should let it have its way with the OS for a bit.

« Older posts

© 2020 More Than Four

Theme by Anders NorenUp ↑