Install Reposado with Margarita on CentOS / Red Hat Enterprise Linux

Margarita installation

The instruction to install Margarita are available on the github project. The instruction on this post will be specific to the CentOS / Red Hat Enterprise Linux installation, if more informations are needed please consult the Margarita project.

– Start by installing the needed libraries :

easy_install flask
easy_install simplejson

– Go to the root of your drive and clone the sources of Margarita to your server :

cd /
git clone git://

– Move the margarita directory to /usr/local/sbin/ :

mv margarita/ /usr/local/sbin/

– Margarita needs to know where are stored the Reposado files. Go to the Margarita directory and create a symbolic link to the directories :

cd /usr/local/sbin/margarita
ln -s /usr/local/sbin/reposado/code/reposadolib/ .
ln -s /usr/local/sbin/reposado/code/preferences.plist .

– Add a rule to local firewall to allow the TCP port 8089 and save it :

iptables -I INPUT -p tcp --dport 8089 -j ACCEPT
iptables-save > /etc/sysconfig/iptables

– Try if everything is correctly configured by starting manually Margarita (CTRL-C to exit) :

/usr/bin/python /usr/local/sbin/margarita/

– With your browser you can access the web interface using the port 8089 :

 Add service for Margarita

CentOS and Red Hat Enterprise Linux uses the command “service” to manage daemon. Ideally, we need to create a service also for Margarita. Thus the installation will be clean.

– Add a new file named “margarita” to the /etc/init.d/ directory :

vi /etc/init.d/margarita

– Enter to the “Insert mode” by pressing the “i” key, and copy/paste the entire script below :

# chkconfig: 3 99 01
# description: Manage Reposado by the web interface Margarita
# processname: margarita

case "$1" in

nohup /usr/bin/python /usr/local/sbin/margarita/ >/dev/null 2>&1 &



MARGARITA_PID=`ps aux | grep | grep -v grep | awk '{ print $2 }'`


$0 stop
$0 start


if ps aux | grep | grep -v grep >/dev/null 2>&1; then
echo "Running"
exit 0
echo "Not Running"
exit 1


echo "Usage: $0 {start|stop|restart|status}"
exit 1

– Exit the “Insert mode” by pressing the “ESC” key. Your file should look like this :

– Press the key “:” and enter the command “wq” to write the file and quit vi. The command appears at the bottom left of the screen. If you want to quit the file without saving, you can use the command :q!.

– Change the file permission for the “margarita” service :

chmod 755 /etc/init.d/margarita

– Add the new script to the startup items on the server (and to the command service) :

chkconfig --add margarita
chkconfig margarita on

– Verify that the script is correctly managed with a runlevel 3 :

chkconfig --list

– Reboot the server to be sure that everything is restarting fine on boot :


– Reconnect to the server and check if Margarita is running :

service margarita status

– Check if the web interface is working.

12 Replies to “Install Reposado with Margarita on CentOS / Red Hat Enterprise Linux”

  1. absolutely beautiful howto guide – worked perfectly

    also, per the instructions here, i added a .htaccess file to the directory /var/local/reposado/html

    with instructions found here:

    so as i only needed to put the catalogURL as on client machines and the apache2 mod_rewrite engine on the reposado box figured out which index to send it to regardless of version of the macosx client

    again, thank you for this wonderful page.

  2. I was curious if you have found a way to secure this with .htaccess? I have so far been unsuccessful. Margarita doesn’t respect the the file.

  3. Thanks for this tutorial.

    The standard command to configure the client is:
    sudo defaults write /Library/Preferences/ CatalogURL

  4. failure: repodata/c7c64887b23d8a76ac7d8b0b4a2673a3e832963c948a8700c8647f4fa8bbd339-primary.sqlite.bz2 from updates: [Errno 256] No more mirrors to try.

    problem connecting to softer sources

    plz help me in this regards

    thank u

  5. Brilliant work here…a single run through the setup process on Centos 6.5 resulted in a fully working reposado + margarita configuration.

    Thank you for providing such a detailed walkthrough.

  6. I am not familiar with reposado but we have working outdated reposado and just wonder how can I update so the yosemette and elcapitan clients can update from?

Leave a Reply

Your email address will not be published.