Blog | Mezzaninehttp://senexcanis.com/blog/feeds/rss/BlogenComicCppHeaderParserHOWTOLinuxProjectMon, 13 Feb 2012 20:39:02 +0000Setup Mercurial server with multiple repositories on OpenSUSEhttp://senexcanis.com/blog/setup-mercurial-server-with-multiple-repositories-on-opensuse/<p>This tutorial is to configure a Mercurial/hg server for multiple repositories on OpenSUSE.  Be sure to follow these steps on the server you want to host the repositories on.</p> <p>First make sure Mercurial is installed</p> <pre>zypper install hg</pre> <p>Now create a location for the repositories</p> <pre>mkdir -p /var/hg/repos</pre> <p>Create some project as an example</p> <pre>cd /var/hg/repos<br>hg init super_proj</pre> <p>Create a config file for hg to know to what to serve (details <a href="http://mercurial.selenic.com/wiki/PublishingRepositories#Configuration_of_hgweb">here</a>).  In /var/hg/hg_repos.conf insert the following</p> <pre>[paths]<br>/ = /var/hg/repos/*<br><br>[web]<br>push_ssl = false<br>allow_push = *</pre> <p>Now for a startup script (based on <a href="http://mercurial.selenic.com/wiki/hgserve">this</a>).  In /etc/init.d/hg_serve put the following</p> <pre>#! /bin/sh<br>#<br># Startup script for mercurial server.<br>#<br>### BEGIN INIT INFO<br># Provides:       hg server <br># Required-Start: $local_fs $remote_fs $syslog $network <br># Required-Stop:  $local_fs $remote_fs $syslog $network<br># Should-Start:   $time sendmail httpd2 xntpd $named cron ndo2db<br># Should-Stop:    sendmail ndo2db<br># Default-Start:  3 5<br># Default-Stop:   0 1 2 6<br># Short-Description: hg server <br># Description:    hg server<br>### END INIT INFO<br># Change following ines<br>APP_BIN=/usr/bin/hg<br>SRC=/var/hg/repos<br># Path to PID file of running mercurial process.<br>PID_FILE=/var/hg/hg.pid<br>CONFIG_FILE=/var/hg/hg_repos.conf<br><br>state=$1<br><br>case "$state" in<br>'start')<br>    echo "Mecurial Server service starting."<br>   ${APP_BIN} serve --webdir-conf=$CONFIG_FILE -d -p 8001 --pid-file ${PID_FILE}<br>  ;;<br><br>'stop')<br>  if [ -f "${PID_FILE}" ]; then<br>    PID=`cat "${PID_FILE}"`<br>    if [ "${PID}" -gt 1 ]; then<br>      kill -TERM ${PID}<br>      echo "Stopping the Mercurial service PID=${PID}."<br>    else<br>      echo Bad PID for Mercurial -- \"${PID}\"<br>    fi<br>  else<br>    echo No PID file recorded for mercurial<br>  fi<br>  ;;<br><br>'restart')<br>  $0 stop<br>  $0 start<br>  ;;<br><br>*)<br>  echo "$0 {start|stop|restart}"<br>  exit 1<br>  ;;<br>esac</pre> <p>Now to finalize things</p> <pre>chmod +x /etc/init.d/hg_serve<br>chkconfig --add hg_serve<br>service hg_serve start</pre> <p>(If you are using Debian/Ubuntu, to activate the script run "update-rc.d hg_serve defaults")</p> <p>Now you should be able to access the server via the web.  Just point your web browser to http://&lt;your server ip&gt;:8001</p> <p>Keep in mind, this setup is for internal servers.  Refer to other resources for securing your data!</p> <p>More information on Mercurial can be found at <a href="http://mercurial.selenic.com/guide/">http://mercurial.selenic.com/guide/</a></p>senexMon, 13 Feb 2012 20:39:02 +0000http://senexcanis.com/blog/setup-mercurial-server-with-multiple-repositories-on-opensuse/HOWTOSSH Keys HOWTOhttp://senexcanis.com/blog/ssh-keys-howto/<p>To log into a remote machine from a local machine<br><br>&nbsp;&nbsp; 1. Check your home directory in the local machine for a .ssh directory. If it's there, look inside for a file named identity.pub or id_rsa.pub. If neither exists, type <strong>ssh-keygen -t rsa</strong><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Just press enter for passphrase, unless you want one. This creates a 1024 bit RSA version 2 keypair (other options for other types) in $HOME/.ssh/identity and $HOME/.ssh/identity.pub, OR in $HOME/.ssh/id_rsa and $HOME/.ssh/id_rsa.pub<br><br>&nbsp;&nbsp; 2. Put a copy of identity.pub or id_rsa.pub (whichever you have) into your home directory on the remote machine:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scp $HOME/.ssh/identity.pub user@remote.machine.com:.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (note the ending dot on the line above, it means "same filename")<br><br>&nbsp;&nbsp; 3. ssh into the remote box with a password, then do this:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Check to see if you have a .ssh directory there. If not,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mkdir .ssh<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chmod 750 .ssh<br><br>&nbsp;&nbsp; 4. If there is no file in the .ssh directory named authorized keys:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cp identity.pub .ssh/authorized_keys<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cp id_rsa.pub .ssh/authorized_keys<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chmod 600 .ssh/authorized_keys<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If .ssh/authorized_keys already exists: cat identity.pub &gt;&gt; .ssh/authorized_keys or<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cat id_rsa.pub &gt;&gt; .ssh/authorized_keys<br><br>&nbsp;&nbsp; 5. Now log out of the remote machine and ssh into it again. You should be logged into your account on the remote machine without having to type a password.<br _mce_bogus="1"></p>senexThu, 08 Jun 2006 15:47:42 +0000http://senexcanis.com/blog/ssh-keys-howto/HOWTOlinux disk copyhttp://senexcanis.com/blog/linux-disk-copy/<p>To copy from one disk to another and preserve permissions do the following:<br></p><p><br></p><p>cd /dir/to/copy<br>tar -cf - * .[A-z]* | tar -C /mnt/new -xvf -</p>senexThu, 08 Jun 2006 15:42:15 +0000http://senexcanis.com/blog/linux-disk-copy/HOWTO