Tag: linux

11 September 2014 » PostgreSQL Notes


12 July 2014 » Arch Linux On Cubox

Key Websites and Forums

Log first install

First up is where to find the install and instructions.

Found the Cubox-I on this forum, ARMv7h

Install instructions here

See the Installation Tab

Zero out the first few MB of the card to remove any previous U-Boot environment:


            dd if=/dev/zero of=/dev/sdc bs=1M count=4
            

Start fdisk to partition the SD card:


            fdisk /dev/sdc
            

At the fdisk prompt, create the new partitions:

Type n, then p for primary, 1 for the first partition on the drive, 8192 for the starting sector, and +20M for the ending sector.

Type t to set the type, then c to set it to FAT.

Type n, then p for primary, 2 for the second partition, 49152 for the first sector, and press ENTER twice to accept default values.

Exit by typing w.

Create and mount the vfat filesystem:


            mkfs.vfat /dev/sdc1
            mkdir /tmp/boot
            mount /dev/sdc1 /tmp/boot
            

Create and mount the ext4 filesystem:


            mkfs.ext4 /dev/sdc2
            mkdir /tmp/root
            mount /dev/sdc2 /tmp/root
            

Download and extract the root filesystem:


            cd /mnt/disk2/linux_distros/
            wget http://archlinuxarm.org/os/ArchLinuxARM-imx6-cubox-latest.tar.gz
            tar -xf /mnt/disk2/linux_distros/ArchLinuxARM-imx6-cubox-latest.tar.gz -C /tmp/root
            

Move boot files to the boot partition:


            mv /tmp/root/boot/* /tmp/boot
            

Install the U-Boot bootloader:


            dd if=/tmp/boot/SPL of=/dev/sdc bs=512 seek=2
            dd if=/tmp/boot/u-boot.img of=/dev/sdc bs=1K seek=42
            

Unmount the partitions


            sync
            umount /tmp/boot
            umount /tmp/root
            

Boot the Cubox-I

Insert the SD card into the Cubox-i contacts uppermost, connect ethernet, and apply 6-12V power.

Use the serial console (CN6 micro USB connector) or SSH to the IP address given to the board by your router. The default root password is ‘root’.


07 September 2014 » Linux Tricks

Find OS version

debian


            $ lsb_release -a
            No LSB modules are available.
            Distributor ID:	Debian
            Description:	Debian GNU/Linux 7.6 (wheezy)
            Release:	7.6
            Codename:	wheezy
            

Scraping Web Sites

wget can get a local copy of a url.


            wget  --convert-links --adjust-extension --page-requisites --no-parent http://www.guitaralive.org/playlist_14_31.html
            
            wget  --convert-links --adjust-extension --page-requisites --no-parent http://www.cpr.org/classical/playlist
            

HTML Tidy can be used as part of editing the scraped HTML

Archive and Compression

7zip tar archives


            apt-get install p7zip-full
            7z a archive.tar.7z archive.tar
            

09 December 2014 » Setup up work Gitlab server

Gitlab Omnibus Readme

Configuration options

Configuration done in file:

  • /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure
            

GitLab and GitLab CI are configured by setting their relevant options in /etc/gitlab/gitlab.rb. For a complete list of available options, visit the gitlab.rb.template. New installations starting from GitLab 7.6, will have all the options of the template listed in /etc/gitlab/gitlab.rb by default.

SMTP settings

If you would rather send application email via an SMTP server instead of via Sendmail, add the following configuration information to /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure.

in /etc/gitlab/gitlab.rb
            gitlab_rails['smtp_enable'] = true
            gitlab_rails['smtp_address'] = "smtp.server"
            gitlab_rails['smtp_port'] = 456
            gitlab_rails['smtp_user_name'] = "smtp user"
            gitlab_rails['smtp_password'] = "smtp password"
            gitlab_rails['smtp_domain'] = "example.com"
            gitlab_rails['smtp_authentication'] = "login"
            gitlab_rails['smtp_enable_starttls_auto'] = true
            

If your SMTP server does not like the default ‘From: gitlab@localhost’ you can change the ‘From’ with this setting.

in /etc/gitlab/gitlab.rb
            gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
            

To change GitLab CI email configuration (e.g. use SMTP), use gitlab_ci instead of gitlab_rails.

in /etc/gitlab/gitlab.rb
            gitlab_ci['gitlab_ci_email_from'] = 'gitlab-ci@example.com'
            gitlab_ci['smtp_enable'] = true
            gitlab_ci['smtp_address'] = "smtp.server"
            

GitLab Community Edition Omnibus package for Debian 7

The current “stable” distribution of Debian is version 7, codenamed wheezy. It was initially released as version 7.0 on May 4th, 2013 and its latest update, version 7.7, was released on October 18th, 2014.

Base install

Hostname: gitlab.gcsww.com


            Software Selection
            ---------------------
            remove Debian desktop environment
            leave Print server
            Add SSH server
            remove laptop
            

            apt-get update
            apt-get dist-upgrade
            
            apt-get install vim
            apt-get install tmux
            apt-get install git
            apt-get install sudo
            
            adduser craig sudo
            
            git config --global user.name "Your Name Here"
             Sets the default name for git to use when you commit
            
            git config --global user.email "your_email@example.com"
             Sets the default email for git to use when you commit
            

            ssh-copy-id -i ~/.ssh/id_rsa.pub $host
            

Gitlab install / Setup

From Debian 7 selection


            wget https://downloads-packages.s3.amazonaws.com/debian-7.6/gitlab_7.5.3-omnibus.5.2.1.ci-1_amd64.deb
            sudo apt-get install openssh-server
            sudo apt-get install postfix # Select 'Internet Site', using sendmail instead also works, exim has problems
            
            Suggested packages:
              postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common resolvconf postfix-cdb ufw postfix-doc
            The following packages will be REMOVED:
              exim4 exim4-base exim4-config exim4-daemon-light
            The following NEW packages will be installed:
              postfix
            
             Internet site:                                                                                                               
              │   Mail is sent and received directly using SMTP. 
            
            System mail name:                                                                                                                                                 │     
                │                                                                                                                                                                   │     
                │ gitlab.gcsww.com
            
            sudo dpkg -i gitlab_7.5.3-omnibus.5.2.1.ci-1_amd64.deb
            
            Setting up gitlab (7.5.3-omnibus.5.2.1.ci-1) ...
            Thank you for installing GitLab!
            Configure and start GitLab by running the following command:
            
            sudo gitlab-ctl reconfigure
            
            GitLab should be reachable at gitlab.gcsww.com
            Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
            And running reconfigure again.
            
            gitlab-ctl reconfigure
            

reconfigure failed the first time. Edit /etc/gitlab/gitlab.rb Also, set the email from.

diff /etc/gitlab/gitlab.rb.1 /etc/gitlab/gitlab.rb
            2c2,4
            < external_url 'gitlab.gcsww.com'
             ---
            > external_url 'http://gitlab.gcsww.com'
            > gitlab_rails['gitlab_email_from'] = 'gitlab@gcsww.com'
            

            2c2
            < external_url 'gitlab.gcsww.com'
            ---
            > external_url 'http://gitlab.gcsww.com'
            

Browse to the hostname and login


            Username: root
            Password: 5iveL!fe 
            

Change password.

smtp access to mail.coot.net

  • server name: mail.coot.net
  • port: 26
  • user name: craig@coot.net
  • Authentication method: Normal password
  • Connection Security: STARTTLS

postfix configuration

Need to configure postfix

$ hostname --fqdn
            gitlab.gcsww.com
            
$ postconf -n
            alias_database = hash:/etc/aliases
            alias_maps = hash:/etc/aliases
            append_dot_mydomain = no
            biff = no
            config_directory = /etc/postfix
            inet_interfaces = all
            mailbox_command = procmail -a "$EXTENSION"
            mailbox_size_limit = 0
            mydestination = gitlab.gcsww.com, localhost.gcsww.com, , localhost
            myhostname = gitlab.gcsww.com
            mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
            myorigin = /etc/mailname
            readme_directory = no
            recipient_delimiter = +
            relayhost =
            smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
            smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
            smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
            smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
            smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
            smtpd_use_tls = yes
            

Postfix on a null client

A null client is a machine that can only send mail. It receives no mail from the network, and it does not deliver any mail locally. A null client typically uses POP, IMAP or NFS for mailbox access.

  1. /etc/postfix/main.cf:
  2. myhostname = hostname.example.com
  3. myorigin = $mydomain
  4. relayhost = $mydomain
  5. inet_interfaces = loopback-only
  6. mydestination =

Translation:

  • Line 2: Set myhostname to hostname.example.com, in case the machine name isn’t set to a fully-qualified domain name (use the command “postconf -d myhostname” to find out what the machine name is).
  • Line 2: The myhostname value also provides the default value for the mydomain parameter (here, “mydomain = example.com”).
  • Line 3: Send mail as “user@example.com” (instead of “user@hostname.example.com”), so that nothing ever has a reason to send mail to “user@hostname.example.com”.
  • Line 4: Forward all mail to the mail server that is responsible for the “example.com” domain. This prevents mail from getting stuck on the null client if it is turned off while some remote destination is unreachable. Specify a real hostname here if your “example.com” domain has no MX record.
  • Line 5: Do not accept mail from the network.
  • Line 6: Disable local mail delivery. All mail goes to the mail server as specified in line 4.

  • Linode - Configure Postfix to Send Mail Using an External SMTP Server
Edit /etc/postfix/main.cf
            /etc/postfix# diff main.cf.1 main.cf
            33,35c33,35
            < myorigin = /etc/mailname
            < mydestination = gitlab.gcsww.com, localhost.gcsww.com, , localhost
            < relayhost = 
            ---
            > myorigin = $mydomain
            > mydestination =
            > relayhost = [mail.coot.net]:26
            40c40,54
            < inet_interfaces = all
            ---
            > inet_interfaces = loopback-only
            > 
            > # see - https://www.linode.com/docs/email/postfix/postfix-smtp-debian7
            > # enable SASL authentication 
            > smtp_sasl_auth_enable = yes
            > # disallow methods that allow anonymous authentication. 
            > smtp_sasl_security_options = noanonymous
            > # where to find sasl_passwd
            > smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
            > 
            > # Enable STARTTLS encryption 
            > smtp_use_tls = yes
            > # where to find CA certificates
            > smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
            > 
            
Configuring SMTP Usernames and Passwords
/etc/postfix/sasl_passwd
            [mail.coot.net]:26 craig@coot.net:mypassword
            
Create the hash db file for Postfix by running the postmap command:
postmap /etc/postfix/sasl_passwd
            

If all went well, you should have a new file named sasl_passwd.db in the /etc/postfix/ directory.

Securing Your Password and Hash Database Files

The /etc/postfix/sasl_passwd and the /etc/postfix/sasl_passwd.db files created in the previous steps contain your SMTP credentials in plain text.

For security reasons, you should change their permissions so that only the root user can read or write to the file. Run the following commands to change the ownership to root and update the permissions for the two files:

Change permissions of sasl_passwd and sasl_passwd.db
            chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
            chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
            
Test
echo "body of your email" | mail -s "This is a Subject" -a "From: you@example.com" recipient@elsewhere.com
            
10.10.9.175
            http://gitlab.gcsww.com/cootcraig/game_justin_craig_20141209.git
            http://10.10.9.175/cootcraig/game_justin_craig_20141209.git
            
            git remote set-url origin http://10.10.9.175/cootcraig/game_justin_craig_20141209.git
            

postfix research

Install Gitlab virtualbox guest on vmhost

Unpack and initial setup

dhcp ip: 10.10.9.162

Pick a static IP

DNS for Gitlab

gitlab.gcsww.local 10.10.22.6

research

bitnami Review - 10/18/2014 - Easy to install and configure - By Nacho Sanchez

Installation takes 5 minutes, and configuration is very easy since they include links to FAQs and basic stuff you should know.

Configuring the email can get tricky, so here is the basic stuff:

Be careful with the host and port, since it sets the ones where the machine installs by default, but if you then assign a static IP you must change them manually.


10 September 2014 » Debian Remote Dummy X on Virtual Box


09 May 2014 » Debian Virtualbox Host

Notes on setting up a Debian Virtualbox host for my employer

Overview

https://www.virtualbox.org/manual/

https://blogs.oracle.com/virtualization/entry/new_commercial_license_for_oracle

  • Oracle VM VirtualBox Enterprise - Named User Plus - $50 per named user
  • Oracle’s standard processor licensing, $1,000 per processor socket

Setting up the host box.

How to autostart vms

Good guide to setting up autostart

http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/

Log

First you need to create the file /etc/default/virtualbox and add a few variables.


            VBOXAUTOSTART_DB=/etc/vbox
            VBOXAUTOSTART_CONFIG=/etc/vbox/vbox.cfg
            

Create the file /etc/vbox/vbox.cfg


            root# mkdir /etc/vbox
            

With one line.


            default_policy = allow
            

Set permissions on directory to the vboxuser group and make sure users can write to the directory as well as sticky bit.


            root# chgrp vboxusers /etc/vbox
            root# chmod 1775 /etc/vbox
            

Add administrator to the vboxusers group.


            root# groups administrator
            administrator : administrator sudo
            
            root# usermod -a -G vboxusers administrator
            
            root# groups administrator
            administrator : administrator sudo vboxusers
            

Every user who wants to enable autostart for individual machines has to set the path to the autostart database directory with


            administrator$ VBoxManage setproperty autostartdbpath /etc/vbox
            

List the vms


            administrator$ VBoxManage list vms
            "craigdeb" {0e7bca8b-b552-4ebb-9e39-bb1f6fb19d5c}
            

            administrator$ VBoxManage modifyvm craigdeb --autostart-enabled on
            

            root# update-rc.d virtualbox defaults
            

After log place holder


            code
            

09 December 2014 » Minimal install for i3wm on Debian Jessie

Hope to make Debian with i3wm my Linux home


            apt-get install remmina remmina-plugin-rdp remmina-plugin-vnc
            

27 July 2014 » Pueblo trash roll offs

==================== from yellow pages C&C Disposal 582-8940

C-Spicola’s Roll-Off Service 546-9488

A-Affordable Disposal 542-8757

==================== Waste Connections of Pueblo

$300.00 10 days 20 yards 7.5 x 4 x 22

10 yard 7.5 x 3.5 x 14 $300.00 10 days

end gate? yes for both


Waste Connections of Pueblo

http://wcpueblo.rtrk.com/?scid=3084219&kw=1933994:18209&pub_cr_id=37977018385

Dumpster Sizes

2 yard 3 yard 4 yard 6 yard 8 yard Roll-off Sizes

10 Yard Size: 14’ x 8’ x 3’ 20 Yard Size: 22’ x 8’ x 3’5” 30 Yard Size: 22’ x 8’ x 5’ 40 Yard Size: 22’ x 8’ x 7’

Copyright © 2014 Waste Connections of Colorado Inc. 28900 E Hwy 96 - Pueblo, Colorado 81001 Phone 719-423-6639 - Fax 719-948-3652

======================= http://www.ccdisposalco.com/RollOffs/tabid/1764/Default.aspx C&C Disposal 582-8940

Roll-Offs

Our locally owned business offers multiple dumpster sizes for large disposal rental to meet your needs. Roll off dumpster rental sizes are measured in cubic yards. We’ve included the dumpster dimensions for each of these roll off dumpster sizes below. If you have questions about renting or the size you might need, please call us at 719-647-9100.

Roll-Off and Large Dumpster Rental Terms 6 Yard Dumpster

A 6 yard dumpster can hold 6 cubic yards of waste. Dumpster dimensions for a 6 yard dumpster are: 6 ft. deep by 5 ft. 6 in. wide by 6ft. high. This dumpster is great for yard, garage, estate and remodel clean ups. If you have limited space for a container or a clean up that may take you several weekends this is the dumpster for you. Rental options ranging from one time pick up to monthly rental that includes a weekly pick up.

month 4 pickups - 280.

10 Yard Dumpster

A 10 yard dumpster can hold 10 cubic yards of waste. Dumpster dimensions for the 10 yard dumpster are: 12 ft. long by 8 ft. wide by 4 ft. high. There’s no perfect way to choose dumpster sizes, but a 10 yard dumpster may be appropriate for a small basement or garage cleanout; removing a 250 sq. ft deck; removing 1500 sq. ft. of single layer roof shingles; yard debris cleanup, or a small kitchen & bath remodeling job.

15 day - $280

20 Yard Dumpster

A 20 yard dumpster holds 20 cubic yards of waste. Dumpster dimensions for a 20 yard dumpster are: 20 ft. long by 8 ft. wide by 4 ft. high. A 20 yard dumpster may be the right dumpster size for a large basement, attic, or garage cleanup; flooring and carpet removal for a large house; 300 to 400 square feet of deck removal; or 2500 to 3000 sq. ft. of single layer roof shingle removal.

15 day - $300

30 Yard Dumpster

A 30 yard dumpster holds 30 cubic yards of waste. Dumpster dimensions for a 30 yard dumpster are: 22 ft. long by 8 ft. wide by 6 ft. high. A 30 yard dumpster may be the right dumpster size for a major home addition; construction of a new home; demolition of a garage; or entire house window or siding replacement for a small to medium size home.

40 Yard Dumpster

A 40 yard dumpster holds 40 cubic yards of waste. Dumpster dimensions for a 40 yard dumpster are: 22 ft. long by 8 ft. wide by 8 ft. high. A 40 yard dumpster may be appropriate for window or siding replacement for a large home; commercial roof tear off; commercial cleanout; new construction or major addition; large amount of trash, paper, or cardboard.

40 Yard Compactor Receiver

A 40 yard compacter receiver is ideal for businesses with an extremely high volume of waste. This compacter receiver requires a permanent installation of a stationary compactor that packs waste into a 40 yard receiver box.

=================================== C-Spicola’s Roll-Off Services ===================================


A-Affordable Disposal 542-8757

15 yard 17 x 8 x 5 $285 30 days. 1 pickup.

none Sept. 8.


03 September 2014 » Using Debian 7 (Wheezy)

Overview - Switch from Lubuntu to Debian

Disruptive motivators:

Netinstall - then …

BASIC DEV. TOOLS: COMPILER,VIM,TMUX,GIT

Compiler and build tools


            sudo apt-get install build-essential checkinstall libtool automake uuid-dev
            

vim (or vim-gtk),tmux,git


            sudo apt-get install vim tmux git
            

Personalize git


            git config --global user.name "Your Name Here"
             # Sets the default name for git to use when you commit
            
            git config --global user.email "your_email@example.com"
             # Sets the default email for git to use when you commit
            

Install the rsa public key on my github account


            ssh-keygen
            

Then clone the vim config and install


            cd
            git clone git@github.com:CootCraig/dotfiles_again.git
            cd ~/dotfiles_again/linux
            bash install.sh
            

Look at /home/craig/dotfiles_again/windows/vimfiles/bundle/Readme.txt for setting up the vim bundles.

arrange for mounting windows shares


            apt-get install cifs-utils winbind
            

Add the shares to mount. Sample entry in /etc/fstab


            //gcs3/f$/GIT /media/gcsgit cifs rw,noauto,credentials=/home/craig/gcsww_canderson.txt,uid=craig 0 0
            

Template credentials file


            username=a_user
            password=a_password
            domain=gcsww
            

Java SE 8u20

Extracted jdk tar to /opt/java. Make external link.


            /opt/java/jdk -> /opt/java/jdk1.8.0_20/
            

Modified /etc/profile


            if [ "`id -u`" -eq 0 ]; then
              PATH="/opt/java/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            else
              PATH="/opt/java/jdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
            fi
            

JRuby

Unpacked to /opt/jruby. Make symbolic link:


            /opt/ruby/jruby -> /opt/ruby/jruby-1.7.15/
            

Added /opt/ruby/jruby/bin to path in /etc/profile

vm guest use xorg dummy driver

xfce desktop


            sudo apt-get install xorg xfce4 gdm3 xfce4-goodies
            

Package: xserver-xorg-video-dummy (1:0.3.5-2 and others) X.Org X server – dummy display driver This package provides a ‘dummy’ display driver, which does not actually display anything.

http://xpra.org/xorg.conf

HOWTO: headless, custom xorg resolution/modeline with vnc access to display 0 console http://ubuntuforums.org/showthread.php?t=1832456

(This HOWTO will cover different aspects you might not need all of this, but if you need a) a custom resolution b) setup headless access c) access to the console (display :0)remotely part of this may be useful to you.)

So this was going to be a question but it turned into a HOWTO after spending hours on this.

PROBLEM #1: I needed remote access to the console (display :0) of a server from a laptop because I needed to access the audio hardware (though I’m sure there are different reasons one needs access to :0) so nx, tightvnc, xvnc were all out. PROBLEM #2: The server had no monitor attached PROBLEM #3: I was connecting with a laptop that had a resolution of 1280x800 but of course windows (and other OSes) have a task bar, so the actually workable area is less than that. I needed a resolution of 1224x685 (not your typical resolution). PROBLEM #4: need the vnc server to start at boot to allow login from the server (no monitor).

1) Install x11vnc (this seems to be the only vnc server I found that allows console access, nomachine 4 (coming soon) and nomachine 3 have some form of ‘physical screen’ access, but I had a hard time with managing the audio hardware with that so I needed to use vnc.

http://askubuntu.com/questions/390113/x11vnc-much-slower-than-xvnc-how-to-get-a-xubuntu-session-manually

http://www.arachnoid.com/modelines/index.html

Headless VNC-Server using xvfb http://gpio.kaltpost.de/?page_id=84

Xvfb on Debian 7 https://github.com/tansaku/LocalSupport/wiki/Xvfb-on-Debian-7

How to use RDP from Windows to connect to Debian or Ubuntu machine http://blog.technotesdesk.com/how-to-use-rdp-from-windows-to-connect-to-debian-or-ubuntu-machine/

JRuby

Desktop howto

XFCE desktop

Use xfce 4.10 on Debian 7

Config notes

multiple monitors

arandr to generate monitor set script

Windows netbios names

Virtual Box autostart guest

https://wiki.debian.org/VirtualBox#Kernel_driver_not_installed_.28rc.3D-1908.29

Debian service management


09 December 2014 » Setup up work Git server with Gogs

Setup up work Git server with Gogs

Install a Debian 7 virtualbox guest to host the company GIT repositories.

Use Debian stable wheezy

Debian 7.7 net install iso

The current “stable” distribution of Debian is version 7, codenamed wheezy. It was initially released as version 7.0 on May 4th, 2013 and its latest update, version 7.7, was released on October 18th, 2014.

Base install

Hostname: gogs.gcsww.local


            Software Selection
            ---------------------
            remove Debian desktop environment
            leave Print server
            Add SSH server
            remove laptop
            

            apt-get update
            apt-get dist-upgrade
            
            apt-get install vim
            apt-get install tmux
            apt-get install git
            apt-get install sudo
            
            adduser craig sudo
            

Put local ssh public key on gogs server

Step 2: Copy the public key to remote-host using ssh-copy-id


            jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
            jsmith@remote-host's password:
            Now try logging into the machine, with "ssh 'remote-host'", and check in:
            
            .ssh/authorized_keys
            
            to make sure we haven't added extra keys that you weren't expecting.
            
            ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.88.183
            ssh 192.168.88.183
            

Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

gogs Install Howto for Debian 7 Wheezy

Here is how to install the package on a Debian 7 Wheezy 64bits server:


            ssh 192.168.88.183
            

https support was missing from apt-get after install


            apt-get install apt-transport-https
            

Here is how to install the package on a Debian 7 Wheezy 64bits server:


            wget -qO - https://deb.packager.io/key | sudo apt-key add -
            echo "deb https://deb.packager.io/gh/pkgr/gogs wheezy pkgr" | sudo tee /etc/apt/sources.list.d/gogs.list
            sudo apt-get update
            sudo apt-get install gogs
            
            The following NEW packages will be installed:
              gogs libevent-core-2.0-5 libevent-extra-2.0-5 libmysqlclient18 libpq5 libreadline5 libxslt1.1 mysql-common
            
            Setting up gogs (0.5.8-1418206274.9ee80e3.wheezy) ...
            Scaling up...
            update-rc.d: using dependency based boot sequencing
            update-rc.d: using dependency based boot sequencing
            update-rc.d: using dependency based boot sequencing
            gogs-web-1 started.
            --> done.
            

            APP_NAME="gogs"
            MYSQL_PASSWORD="change_me"
            HOSTNAME="example.com"
            
            debconf-set-selections <<CONFIG
            mysql-server-5.5 mysql-server/root_password password ${MYSQL_PASSWORD}
            mysql-server-5.5 mysql-server/root_password_again password ${MYSQL_PASSWORD}
            CONFIG
            

            APP_NAME="gogs"
            MYSQL_PASSWORD="change_me"
            HOSTNAME="example.com"
            
            apt-get install -y --force-yes mysql-server
            
            The following NEW packages will be installed:
              libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl mysql-client-5.5 mysql-server mysql-server-5.5 mysql-server-core-5.5
            

            APP_NAME="gogs"
            MYSQL_PASSWORD="change_me"
            HOSTNAME="example.com"
            
            mysql -uroot -p${MYSQL_PASSWORD} -e "create database if not exists ${APP_NAME};"
            

            apt-get install -y nginx
            
            The following NEW packages will be installed:
              nginx nginx-common nginx-full
            

            APP_NAME="gogs"
            MYSQL_PASSWORD="change_me"
            HOSTNAME="example.com"
            
            cat > /etc/nginx/sites-available/default <<EOF
            server {
              listen          80;
              server_name     ${HOSTNAME} "";
              location / {
                proxy_pass      http://localhost:6000;
              }
            }
            EOF
            

            sudo service nginx restart
            

Now, access http://${HOSTNAME} and finish the installation process. Easy!


            http://10.10.9.186/craig/game_justin_craig_20141209
            
            git remote add origin http://localhost:6000/craig/game_justin_craig_20141209.git
            git push -u origin master
            

            was
            origin	/media/gcs3f/GIT/game_justin_craig_20141209.git 
            
            git remote set-url origin http://10.10.9.186/craig/game_justin_craig_20141209
            
            
            ssh://[user@]host.xz[:port]/path/to/repo.git/ 
            gogs@localhost:craig/game_justin_craig_20141209.git
            
            git remote set-url origin craig@10.10.9.186:craig/game_justin_craig_20141209.git
            
            

On reboot gogs service not running

Some background on Debian boot up services

update-rc.d Cheat Sheet - James Coyle


            service --status-all
             ...
             [ ? ]  gogs
             [ ? ]  gogs-web
             [ - ]  gogs-web-1
             ...
            

insserv is a low level tool used by update-rc.d which enables an installed system init script (boot script) by reading the comment header of the script, e.g.:

The dependency-based boot sequencing introduced with Debian 6.0 is now always enabled, including for users of file-rc.

For optimal sequencing, all init.d scripts should declare their dependencies in an LSB header. This is already the case for scripts shipped in Debian, but users should check their local scripts and consider adding that information.

For more information on this feature refer to the information available in /usr/share/doc/insserv/README.Debian.

Starting with Debian 6.0, the insserv command is used instead, if dependency-based booting is enabled:


            insserv mydaemon
            

Where mydaemon is an executable init script placed in /etc/init.d. insserv will produce no output if everything went OK. Examine the error code in $? if you want to be sure.

Both the old and the new way requires an init script to be present in /etc/init.d. For dependency-based booting, the script needs to be an LSB init script.

Let’s fix it


            /etc/init.d/gogs
            /etc/init.d/gogs-web
            /etc/init.d/gogs-web-1
            

To see all the files the package installed onto your system, do this:


            dpkg-query -L 
            
            
            

            /opt/gogs/conf/app.ini
            
## migrate existing * [Moving A Git Repository To A New Server - Nik Sumeiko](http://www.smashingmagazine.com/2014/05/19/moving-git-repository-new-server/)

12 December 2014 » How to secure Debian https ssh

Goal

Reasonable security for public Debian 7 server with:

  • https
  • ssh

Research