• LOGIN
  • No products in the cart.

Become FreeBSD User: Find Useful Tools

If you’re usually programming on Linux and you consider a potential switch to FreeBSD, this article will give you an overview of the possibilities.

How to Install the Dependencies

FreeBSD comes with either applications from binary packages or compiled from sources (ports). They are arranged according to software types (programming languages mainly in lang (or java specifically for Java), libraries in devel, web servers in www …) and the main tool for modern FreeBSD versions is pkg, similar to Debian apt tools suite. Hence, most of the time if you are looking for a specific application/library, simply

pkg search <name>

without necessarily knowing the fully qualified name of the package. It is somehow sufficient. For example pkg search php7 will display php7 itself and the modules. Furthermore, php70 specific version and so on.

The main difference is, you are not forced to either choose the binary or the port but can have both if it suits your need. Nonetheless, bear in mind that compiling from the source can take a certain amount of time to achieve if it’s an important point for you. If the ports tree is not already present on your server, portsnap fetch extract will fetch the ports tree for you by default in /usr/ports. Then, related to the software type described above, you  need to go to the related folder. For example, for installing php7:

cd /usr/ports/lang/php70

make config-recursive

make install clean

The second command, depending on which options you are going to choose, will display all the options available for each dependency (for example, if gd support is enabled,  the options for graphics/gd library will appear).

However, most of the time the binary packages are sufficient to cover most of the needs.

Web Development

Basically, this is the easiest area to migrate to. Most  Web languages do not use  specific platform features. Thus, most of the time, your existing projects might just be “drop-in” use cases.

If your language of choice is PHP, you are lucky as this scripting language is workable on various operating systems, on most  Unixes and Windows. In the case of FreeBSD, you have even many different ports or binary package versions (5.6 to 7.1). In this case, you may need some specific PHP modules enabled, luckily they are available atomically, or if the port is the way you chose, it is via the www/php70-extensions’s one.

Of course developing with Apache (both 2.2 and 2.4 series are available, respectively www/apache22 and www/apache24 packages), or even better with Nginx (the last stable or the latest development versions could be used, respectively www/nginx and www/nginx-devel packages) via php-fpm is possible.

Besides PHP, the same applies for Python / Django (www/py-django) and Ruby on Rails (www/rubygen-rails), Golang 1.8.1, Python 2.7 and 3.6 (lang/python<version>) are available as Ruby until 2.4 (lang/ruby<version>).

In terms of databases, we have the regular RDMBS like MySQL and PostgreSQL (client and server are distinct packages … databases/(mysql/portgresql)<version>-client, and databases/(mysql/postgresql)<version>-server). Additionally, a more modern concept of NoSQL with CouchDB, for example (databases/couchdb), MongoDB (databases/mongodb), and Cassandra (databases/cassandra), to name but a few.

Also, if you need to perform efficient Map / Reduce for Big Data work; you can have either the well-known Apache Hadoop or Apache Spark (respectively devel/hadoop and devel/spark). Lastly, in case you ever need any search engine, Apache Solr/Lucene (textproc/apache-(solr/lucene)), Xapian (databases/xapian) and their various language bindings are available.

Is it only Java Web or any language which is based on the Java VM platform? In FreeBSD, Java 8 (either java/openjdk8 or java/linux-oracle-jdk18), various popular frameworks and J2EE servers, servlet engines like Spring (java/springframework), Jboss (java/jboos<version>), Tomcat (www/tomcat<version>), Jetty (www/jetty), etc. are available. Even the more modern languages like Scala (lang/scala), Groovy (lang/groovy) can be found.

Two languages described above, Python and Ruby, have their Java VM counterparts, Jython (lang/jython) and Jruby (lang/jruby), available as well,

In terms of Integrated Development Environment, there are still several choices. For instance, the venerable Netbeans (java/netbeans or java/netbeans-devel) and Eclipse (java/eclipse … side note, FreeBSD needs to have Kerberos support enabled, NO_KERBEROS is /etc/make.conf or /etc/src.conf presence needs to be checked) with their numerous popular plugins.

Low-level Development

The BSD are shipped with  C and C++ compilers in the base. In the case of FreeBSD 11.0, it is clang 3.8.0 (in x86 architectures) otherwise, modern versions of gcc exist for developing with C++11. Examples are of course available too (lang/gcc<version> … until gcc 7.0 devel).

Numerous libraries for various topics are also present, web services SOAP with gsoap through User Interfaces with GTK (x11-toolkits/gtk<version>), QT4 or QT 5 (devel/qt<version>), malware libraries with Yara (security/yara), etc.

In terms of IDEs, Eclipse and Netbeans described above allow both C/C++ development. Anjuta and Qtcreator are also available for important projects. If you prefer, FreeBSD has in base vi and Vi Improved which can be found in ports / packages (editors/vim or editors/vim-lite without X11 support).

FreeBSD is a POSIX system, hence porting C/C++ code to this platform depends on the degree of portability of your projects, so the usage of specific “linuxisms” and such.

In case you need more information about porting software in FreeBSD and its specific tools, I would recommend you to read the BSDMag issues no 66 and 68.

Android / Mobile Development

To be able to do Android development, to a certain degree, the Linux’s compatibility layer (aka linuxulator) needs to be enabled. Also, x11-toolkits/swt and linux-f10-gtk2 port/package need to be installed (note that libswt-gtk-3550.so and libswt-pi-gtk-3550.so are necessary. The current package is versioned as 3557 and can be solved using symlinks). In the worst case scenario, remember that bhyve (or Virtualbox) is available, and can run any Linux distribution efficiently.

Source Control Management

FreeBSD comes in base with a version of subversion. As FreeBSD source is in a subversion repository, a prefixed svnlite command prevents conflicts with the package/port.

Additionally, Git is present but via the package/port system with various options (with or without a user interface, subversion support).

Conclusion

FreeBSD has made tremendous improvements over the years to fill the gap created by Linux. FreeBSD still maintains its interesting specificities; hence there will not be too much blockers if your projects are reasonably sized to allow a migration to FreeBSD.


About the Author

David Carlier is a software developer since 2001, with several languages from C/C++ to Java, Python and Golang. He is working and living in Ireland since 2012’s fall, co-organiser of Dublin BSD Group meetup.


August 30, 2017

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz
© HAKIN9 MEDIA SP. Z O.O. SP. K. 2013