The CentOS distribution is a famous and stable Linux version derived from RedHat Linux. It’s been one of my favorites and one that you can easily find with hosting providers.
In this article we will install CentOS and OracleXE. It’s worth mentioning the OS team improves the installation process with each version, and you will find out in this tutorial how straightforward it currently is.
1. Installing CentOS We’ll perform a minimal installation; this means, we will not install a graphical interface, because this server is meant to be a web / database test server.
Redirecting all your program output to a file is very simple and can be accomplished like this:
myapp > output.log This line will send all the output generated by myapp to a file named output.log. The contents of output.log will always be overwritten; but you can use a second > to append to the current content like this:
myapp >> output.log As well as with output, it is very useful to redirect the stderr (standard error output) to a file rather than to the screen.
This time we are going to install Solr, the super text search platform on CentOS. The installation process requires a couple extra libraries in order to work: Apache Commons Logging and SLF4J. Installing Java yum install java java -version You must have at least version 1.6 in order to run Solr. If you got Java 1.5, I recommend you to follow this tutorial to get version 1.6.
Installing Tomcat yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps chkconfig tomcat6 on service tomcat6 start Use a web browser to check it is working correctly.
Java 1.5 is the default Java version you get when you ask yum to install it on CentOS. However, several applications need 1.6 in order to run. Just follow the next steps to install it.
Remove Java 1.5
yum remove java-1.5-* Install the rpmforge repository
cd rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt Check if you have a 32 or 64 CentOS version
uname -a For 32 versions (i686) download and install the following repository
iptables is the default firewall you see on any linux computer. It works by allowing (ACCEPTing) or denying (DROPing) connections to the local computer. There are basically three scenarios you can deal with:
INPUT: Connections generated from a different computer targeting yours; for example, when you run a web server on your computer and others want to connect to it. OUTPUT: Connections generated from your computer targeting other computers; for example, when you open a web page or open a remote ssh session.
In few words, you have to configure MySQL to allow remote connections, create a user for connecting and setup your firewall to allow it. You don’t have to do this if you are only connecting from a local application like WordPress.
You need root permissions to perform the following commands.
Configuring MySQL Edit the MySQL configuration file.
nano /etc/my.cnf Allow connections from all your network interfaces by commenting out the following line:
Since the module is not included with the default PHP installation, you have to download it from the official repository:
cd mkdir mongo-php-driver cd mongo-php-driver curl https://codeload.github.com/mongodb/mongo-php-driver/zip/master > mongo-php-driver-master.zip Unzip it
unzip mongo-php-driver-master.zip cd mongo-php-driver-master You need _phpize _to build the module. You can install it from the remi repository:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm yum --enablerepo=remi install php-devel Configure and build
phpize ./configure make all sudo make install Make sure the installation directory is the same as the PHP extension directory by running:
The first step is to configure the repositories. Create the following file /etc/yum.repos.d/10gen.repo with the following contents:
For 32-bit systems:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 enabled=1 For 64-bit systems:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 enabled=1 Install Mongo
yum install mongo-10gen mongo-10gen-server Configure MongoDB You can configure Mongo by editing the following file:
/etc/mongod.conf Set Mongo to autostart on system boot:
chkconfig mongod on Start Mongo
service mongod start Stop Mongo
Well, that depends on several things, like your current processor and compiler. The best way to know it, is by using the sizeof operator. Copy the following code, compile it and run it:
#include <iostream> using namespace std; int main() { cout << "char: " << sizeof(char) << endl; cout << "int: " << sizeof(int) << endl; cout << "long: " << sizeof(long) << endl; return 0; } Happy coding…
Learning how to create a Makefile is one of those tasks every C/C++ programmer has to do. Since there are many good make tutorials on the web, I’m only going to share a simplistic makefile that you can use for your projects.
CFLAGS=-c -Wall -Iinclude LDFLAGS=-lPocoFoundation -lPocoData SOURCES=a.cpp b.cpp main.cpp OBJECTS=$(SOURCES:.cpp=.o) VPATH=src all: pre $(OBJECTS) g++ $(OBJECTS) -o build/main $(LDFLAGS) .cpp.o: g++ $(CFLAGS) $< -o $@ pre: mkdir -p build clean: rm -Rf build rm -f *.