I wanted to install MongoDB on an old 32-bit laptop of mine. After installing it from the official repository, the mongo shell died with the following error: ” Illegal instruction (core dumped)”.
The problem is that the binary file uses an instruction set that is not supported by my old 32-bit CPU:
$ cat /proc/cpuinfo | grep flags flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx bts est tm2
SSE3 is missing :( What to do? Uninstall the mongodb package and 1) compile it from source, 2) install it and 3) make it start at startup.
(1) Compile the source
I found an excellent blog post about it at http://kdenby.homelinux.com/?p=25 . Here I would sum up the steps.
Download the source from here: https://www.mongodb.org/downloads . It’s about 35 MB. The source uses the SCons build system, so install the “scons” package too. Note that the compilation process took about 6 hours on my old laptop and the work directory where compilation was being done grew to 18 GB! I didn’t have that much free space so I had to move this work directory to an external HDD :) However, when you install the binaries, they will only occupy 90 MB.
So, if you have an old CPU, edit the file
if using_gcc() or using_clang(): myenv.Append( CCFLAGS=['-march=pentium3', '-mtune=generic'] ) #myenv.Append( CCFLAGS=['-march=nocona', '-mtune=generic'] )
The target architecture “nocona” was replaced by “pentium3”. Again, this tip is from Karl.
After this you can start the compilation and wait :)
$ scons --disable-warnings-as-errors --32 all
The blog post at http://kdenby.homelinux.com/?p=25 stops at this point.
(2) Install the binaries
I installed the binaries to
$ scons --prefix=/opt/mongo-3.0.5 install
Of course, replace “3.0.5” with your current version. I also put a symbolic link on this folder:
$ cd /opt $ ln -s mongo-3.0.5 mongo
Note that the binaries are put into a “
bin” folder, thus they are located in “
Now put symbolic links in
/usr/bin/ that point to the appropriate binaries in
/opt/mongo/bin/. They look like this on my machine:
$ cd /usr/bin $ ls -al | grep mongo lrwxrwxrwx 1 root root 20 11.08.2015 08:30 mongo -> /opt/mongo/bin/mongo lrwxrwxrwx 1 root root 21 11.08.2015 08:31 mongod -> /opt/mongo/bin/mongod lrwxrwxrwx 1 root root 24 11.08.2015 08:31 mongoperf -> /opt/mongo/bin/mongoperf lrwxrwxrwx 1 root root 21 11.08.2015 08:31 mongos -> /opt/mongo/bin/mongos lrwxrwxrwx 1 root root 25 11.08.2015 08:31 mongosniff -> /opt/mongo/bin/mongosniff
(3) Make MongoDB start at startup
Create these two directories:
/var/log/mongodb . The mongo daemon shouldn’t run with root privileges, so we create a dedicated user for this purpose and set its password:
$ sudo adduser mongodb $ sudo passwd mongodb
Now, the owner of the previously created two folders will be “
mongodb“, and they will belong to the “
daemon” group. Example on my machine:
$ cd /var/log $ ls -al | grep mongodb drwxr-xr-x 2 mongodb daemon 4096 11.08.2015 09:29 mongodb/
After this, you need to copy some config files as root. They are collected here.
/etc/mongodb.conf . Mine looks like this:
# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details # Run mongod --help to see a list of options bind_ip = 127.0.0.1 quiet = true dbpath = /var/lib/mongodb logpath = /var/log/mongodb/mongod.log logappend = true noprealloc = true smallfiles = true
/usr/lib/systemd/system/mongodb.service . Sample:
[Unit] Description=High-performance, schema-free document-oriented database After=network.target [Service] User=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf [Install] WantedBy=multi-user.target
Now it’s time to enable and start the mongodb service:
$ systemctl enable mongodb.service $ systemctl start mongodb.service
Verify if it’s running:
$ systemctl status mongodb.service
If it seems OK, try to connect to it with the mongo shell using the command “
If the service doesn’t start with the
systemctl command, then try to launch the server manually:
$ mongod --quiet --config /etc/mongodb.conf
You may want to remove the “
--quiet” option. If it has some problems, it will print a more detailed error message than “
I wrote this post one week after I installed MongoDB, but I hope I didn’t forget any steps. Good luck!
For compiling version 3.2.0, I used the following steps:
scons --wiredtiger=off --disable-warnings-as-errors mongo mongod strip mongo strip mongod
The compilation was too long, so I narrowed it down to mongo and mongod only. The resulting binaries were huge, but the command strip did the trick by removing the debug symbols.
We know that “
source” is a bash shell built-in command that executes the content of the file passed as argument in the current shell. It has a synonym: ‘.‘ (dot).
The classical use case is “
source .bashrc” in your HOME directory. You do it when you modify your
~/.bashrc file and you want to activate the changes in the current terminal.
source is an alternative name for
. in bash) command behaves more or less the same as when executing a command.
In POSIX sh, the following two will search for a file named
foo in PATH (only).
foo . foo
while the following two will specifically run and source, respectively, the file named
foo in the current directory (only)
./foo . ./foo
Bash differs slightly (when not running in posix mode) in that when you give
source an argument without any slash (
/) characters (e.g.
source foo), it searches through the PATH variable, like POSIX sh, but then also checks the current directory, if it was not found in PATH.” (end of quote)
Because of this I ran into a strange problem. I had a file called “.venv” that I wanted to source (source .venv) but I got some error. If I renamed the file, it worked well. But I wanted to call it “.venv”. What’s wrong?
As explained above, it turned out that “source” started to look for “.venv” in the PATH first. Somehow it found a different file with the very same name and that caused the problem. When I renamed the file to “not_hidden” or “.jabba”, it worked.
The trivial way is to use “./” by telling source to take the argument from the current directory:
However, in my entire life I thought that “source .bashrc” takes the file .bashrc from the current directory. It should, in my opinion :)
If you also think that “source” shouldn’t do anything with the PATH variable, there is a cure. This feature can be switched off. The command “shopt” is a builtin that allows you to change additional shell optional behavior.
The guilty option is this one:
sourcepath If set, the source builtin uses the value of PATH to find the directory containing the file supplied as an argument. This option is enabled by default.
Simply run “shopt” to see if “sourcepath” is on for you. You can switch it off easily:
shopt -u sourcepath
To make it permanent, add this line to the end of your ~/.bashrc.
After all this ado, I could finally write this:
And this is the beauty of Linux. You learn something new every day :)
Wandbox is a project that allows you to try several languages in your browser. Just paste the code and Wandbox will compile/interpret it and show you the result.
The service can be called via an API too! The API doc. is here: https://github.com/melpon/wandbox/blob/master/kennel/API.rst.
You want to install Aegisub from source.
“Aegisub is a free, cross-platform open source tool for creating and modifying subtitles. Aegisub makes it quick and easy to time subtitles to audio, and features many powerful tools for styling them, including a built-in real-time video preview.” (source)
Aegisub is a wonderful piece of software. It makes subtitle creation almost trivial :)
Here I show you how to build Aegisub 3.1.2 on Ubuntu 13.10 (64 bit). I guess it would work with later versions too after some tweaks :)
- visit http://www.aegisub.org/downloads/ and download the source
- visit http://sourceforge.net/projects/wxwindows/files/latest and download the latest version of wxWindows
- Extract the two archive files. I put them in the
Note that Aegisub requires wxWindows > 2.8!
# install dependencies $ sudo apt-get install build-essential libasound2-dev libass-dev libffms2-dev libfftw3-dev libgl1-mesa-dev libglu1-mesa-dev libgtk2.0-dev libhunspell-dev liblua5.1-dev $ sudo apt-get install intltool $ sudo apt-get install libboost-all-dev $ sudo ldconfig # not sure if necessary here $ cd /opt/wxWidgets-X.Y.Z $ ./configure --with-opengl && make && sudo make install $ sudo ldconfig $ cd /opt/aegisub-X.Y.Z/aegisub $ ./configure --with-boost-libdir=/usr/lib/x86_64-linux-gnu $ make && sudo make install
configure” gave me the following warning: “
configure: error: Could not link against -lGL !“. I could solve this problem with (1) “
install libboost-all-dev“, and (2) add “
--with-boost-libdir=/usr/lib/x86_64-linux-gnu” to “
- Building Aegisub 3.0.1 on Ubuntu 12.04 (this current post is based on this but it’s a bit out-of-date)
I also wanted to install Aegisub on an older laptop of mine that runs Ubuntu 12.04. To make it work, I had to install older versions:
aegisub-3.0.1. I tried different combinations but it was a failure. If you want to save some headache, use these versions :)
I’ve already noticed that the Ubuntu repositories are sometimes very out-of-date. A good example for this is the “mc” package. There is a PPA for Midnight Commander that should solve this problem but it’s also very old. At the time of writing (August 10, 2011), the current stable release is 188.8.131.52 while the PPA contains the version 184.108.40.206 (updated on Sept. 15, 2010).
Since I wanted to use a fresh release of MC, I installed it from source. Steps to follow:
- Download the latest stable source and unpack it.
- For a successful compilation I had to install this package too: “sudo apt-get install libslang2-dev libglib2.0-dev”.
- If it was successful then you should have a binary “
mc” file in the
src/folder. If it’s there, you can remove your current version with “
sudo apt-get remove mc“.
- Then install the new version with “
sudo make install“.
I also had to modify my
.bashrc a bit:
# old: #alias mc='. /usr/share/mc/bin/mc-wrapper.sh' # new: alias mc='. /usr/local/libexec/mc/mc-wrapper.sh'
Installing mc from source is now integrated in jabbatron.