Installing the Development Tools
Before getting underway, the first thing you need to do is install a ClearOS system. Thanks to the age of virtual machines, you no longer need dedicated hardware. Go ahead and install ClearOS 6 on your favorite virtual machine (or dedicated hardware) and get it up and running.
Once you have the system up and running, login as root (we'll get to creating a normal user account momentarily). You can then install a basic set of development tools with the following commands:
yum upgrade yum --enablerepo=clearos-developer,clearos-epel install clearos-devel
You will also want to install your text editor of choice, for example:
yum install vim-enhanced
Create Normal User Account
Now that the developer tools are installed, it is time create a normal user account for development. To avoid the chicken/egg scenario when working on LDAP, we recommend adding a normal Unix/shadow account. The webconfig server will need read access to your developer directory, hence the need for the chmod file permissions changes.
useradd -u 500 devuser passwd devuser su - devuser chmod og+rx /home/devuser
Specify Environment Variables
Next, you need to specify an RPM “dist” tag that will distinguish your RPM packages from others. Please make sure you change the mydist tag to something that distinguishes your rpms. When you are done with your first RPM build, you will see the dist tag in the filename, for example myapp-1.0-1.1.mydist.i386.rpm.
echo "%dist .mydist" >> ~/.rpmmacros echo -e "%_topdir\t$HOME/rpmbuild" >> ~/.rpmmacros
The latter command changes the default build location to our own directory - in this case located within the users home directory in a folder called rpmbuild. It is optional for ClearOS 6.x as rpmbuild can determine the local path, in previous versions the default build location otherwise is /usr/src/redhat.
Create Required Directory Structure
Whether building apps or patching software, you need a directory structure to build RPMs. For app developers, you don't need to know anything about creating RPMs, but you still need a place to put them! To create this directory structure, run:
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
The details of each directory are described in the following table.
| Directory | Description |
|---|---|
| BUILD | Scratch area for the build process |
| BUILDROOT | Scratch area for the installation |
| RPMS/* | Where the build puts the RPMs |
| SOURCES | Source code and patches needed to build an RPM |
| SPECS | RPM spec files |
| SRPMS | Where the build puts the source RPMs |
Now What
Framework - ClearOS Apps
If you are primarily interested in building web-based apps for ClearOS, then your next step is to continue building out your development environment. Continue your journey by reviewing Framework Development Environment.
Packaging - RPMs
If you are primarily interested in packaging and maintaining RPMs, you can jump right into the following Packaging documentation.
Development Environment
