Asus P8H61-M Pro setup note

After boot up with install media partition hard disk(/dev/sda and /dev/sdb) with gdisk as below:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  BIOS boot partition
   2            6144        33560575   16.0 GiB    FD00  Linux RAID
   3        33560576      1953525134   915.5 GiB   FD00  Linux RAID

Create soft raid:

mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sd[ab]2
mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/sd[ab]3

Make file system

mkfs.ext4 /dev/md3
mkswap /dev/md2

Mount file system:

mount /dev/sda3 /mnt


Install the base system:

pacstrap /mnt base base-devel

Generate an fstab with the following command:

genfstab -pU /mnt >> /mnt/etc/fstab

Chroot into our newly installed system:

arch-chroot /mnt

Update RAID configuration:
mdadm –examine –scan >> /etc/mdadm.conf

Write hostname to /etc/hostname:

vi /etc/hostname

Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone:

ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime

Uncomment the selected locale in /etc/locale.gen and generate it with locale-gen:(For Taiwan user uncomment en_US.* and zh_TW.*)

vi /etc/locale.gen
locale-gen

Add the mdadm_udev to the HOOKS list in /etc/mkinitcpio.conf before filesystems like below:

HOOKS="base udev autodetect modconf block mdadm_udev filesystems keyboard fsck"

Create an initial RAM disk with:

mkinitcpio -p linux

Install and configure a bootloader:

pacman -S grub-bios
grub-install --target=i386-pc --recheck --debug /dev/sda
grub-install --target=i386-pc --recheck --debug /dev/sdb
grub-mkconfig -o /boot/grub/grub.cfg

Change root password:

passwd

Reboot system:

exit
umount /mnt
swapoff /dev/md2
reboot

Add user:

adduser USER_NAME
passwd USER_NAME
mkdir /home/USER_NAME
chown USER_NAME:users /home/USER_NAME
chmod 700 /home/USER_NAME

Install openssh:

pacman -S openssh

Modify /etc/ssh/sshd_config uncomment below:

Protocol 2
PermitRootLogin yes

Start sshd and enable sshd at boot up:

systemctl start sshd
systemctl enable sshd

Install LAMP:

pacman -S apache php php-apache mariadb

Create a self-signed certificate:

cd /etc/httpd/conf
openssl genrsa -out server.key 2048
chmod 600 server.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Modify /etc/httpd/conf/httpd.conf:

ServerAdmin XXX@XXX.XXX.XXX
Include conf/extra/httpd-ssl.conf
LoadModule php5_module modules/libphp5.so
Include conf/extra/php5_module.conf

Add below line into /etc/httpd/conf/mime.types:

application/x-httpd-php       php    php5

Modify /etc/php/php.ini:

date.timezone = Asia/Taipei
extension=pdo_mysql.so
extension=mysqli.so
extension=mysql.so

Start mysqld daemon, run the setup script:

systemctl start mysqld.service
mysql_secure_installation

Modify /etc/mysql/my.cnf:

skip-networking

Enable LAMP at startup:

systemctl enable httpd.service
systemctl enable mysqld.service

Install postfix:

pacman -S postfix

Modify /etc/postfix/main.cf

myhostname = NAME.DOMAIN
mydomain = DOMAIN
inet_interfaces = $myhostname, localhost
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = host
mynetworks = X.X.X.X/X, 127.0.0.0/8
relayhost = [XXX.XXX.XXX.XXX]

Install JDK:

yaourt -S jdk ttf-dejavu

Install gitlab dependencies package:

pacman -S zlib libyaml openssl gdbm readline ncurses libffi curl git openssh redis libxml2 libxslt icu python2

Add git user accounts:

useradd -U -m -d /home/git git

Install and config gitlab-shell:

su - git
git clone https://github.com/gitlabhq/gitlab-shell.git
cd gitlab-shell
cp config.yml.example config.yml

Setup gitlab-shell the environment:

su - git
cd gitlab-shell
./bin/install

Create MariaDB database:

su - git
mysql -u root -p
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'your_password_here';
mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
mysql> \q

Installation gitlab:

su - git
git clone https://github.com/gitlabhq/gitlabhq.git gitlab

gitlab basic configuration:

su - git
cd gitlib
cp config/gitlab.yml.example config/gitlab.yml
chown -R git log/
chown -R git tmp/
chmod -R u+rwX  log/
chmod -R u+rwX  tmp/
mkdir /home/git/gitlab-satellites
mkdir tmp/{pids,sockets}
chmod -R u+rwX  tmp/{pids,sockets}
mkdir public/uploads
chmod -R u+rwX  public/uploads
cp config/puma.rb.example config/puma.rb
git config --global user.name "GitLab"
git config --global user.email "gitlab@localhost"
cp config/database.yml.mysql config/database.yml

Install gems:

su - git
gem install charlock_holmes --version '0.6.9.4'
gem install bundler

Modify .bashrc:

PATH=~/.gem/ruby/2.0.0/bin:"$PATH"

Install gems from Gemfile:

su - git
cd gitlab/
bundle install --deployment --without development test postgres

Initialize Database:

systemctl enable redis
systemctl start redis
su - git
cd gitlab/
bundle exec rake gitlab:setup RAILS_ENV=production

Create a virtual host config file for Gitlab, /etc/httpd/conf/vhosts/gitlab:

<VirtualHost *:80>
  ServerName gitlab.myserver.com
  ServerAlias www.gitlab.myserver.com
  DocumentRoot /home/gitlab/gitlab/public
  ErrorLog /var/log/httpd/gitlab_error_log
  CustomLog /var/log/httpd/gitlab_access_log combined

  <Proxy balancer://unicornservers>
      BalancerMember http://127.0.0.1:8080
  </Proxy>

  <Directory /home/gitlab/gitlab/public>
    AllowOverride All
    Options -MultiViews
  </Directory>

  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

  ProxyPass /uploads !
  ProxyPass / balancer://unicornservers/
  ProxyPassReverse / balancer://unicornservers/
  ProxyPreserveHost on

   <Proxy *>
      Order deny,allow
      Allow from all
   </Proxy>
</VirtualHost>

<VirtualHost MY_IP:443>
  ServerName gitlab.myserver.com
  ServerAlias www.gitlab.myserver.com
  DocumentRoot /home/gitlab/gitlab/public
  ErrorLog /var/log/httpd/gitlab_error_log
  CustomLog /var/log/httpd/gitlab_access_log combined

  <Proxy balancer://unicornservers>
      BalancerMember http://127.0.0.1:8080
  </Proxy>

  <Directory /home/gitlab/gitlab/public>
    AllowOverride All
    Options -MultiViews
  </Directory>

  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

  ProxyPass /uploads !
  ProxyPass / balancer://unicornservers/
  ProxyPassReverse / balancer://unicornservers/
  ProxyPreserveHost on

   <Proxy *>
      Order deny,allow
      Allow from all
   </Proxy>

  SSLEngine on
  SSLCertificateFile /home/gitlab/gitlab/ssl.cert
  SSLCertificateKeyFile /home/gitlab/gitlab/ssl.key
</VirtualHost>

Modify /etc/httpd/conf/httpd.conf:

Include conf/vhosts/gitlab

Create /etc/systemd/system/gitlab-worker.service:

[Unit]
Description=Gitlab Resque Worker
Requires=redis.service
After=redis.service
Wants=postfix.service mysqld.service
 
[Service]
Type=forking
User=git
WorkingDirectory=/home/git/gitlab
ExecStart=/bin/sh -c "RAILS_ENV=production bundle exec rake sidekiq:start"
ExecStopPost=/bin/sh -c "RAILS_ENV=production bundle exec rake sidekiq:stop"
PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid

Create /etc/systemd/system/gitlab.service

[Unit]
Description=Self Hosted Git Management
Requires=mysqld.service redis.service
After=mysqld.service redis.service
Wants=postfix.service gitlab-worker.service
 
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
ExecStart=/bin/sh -c "/usr/bin/bundle exec unicorn_rails -c /home/git/gitlab/config/unicorn.rb -E production"
PIDFile=/home/git/gitlab/tmp/pids/unicorn.pid
 
[Install]
WantedBy=multi-user.target

Start and enable gitlab service:

systemctl start gitlab.service
systemctl enable gitlab.service

Setup database for TikiWiki:

mysqladmin -uroot -p create tiki11
mysql tiki11 -uroot -p -e"GRANT ALL ON tiki11.* TO tikidb@localhost IDENTIFIED BY 'PASSWORD'"

Install TikiWiki:

  1. download tikiwiki and unzip to your web server root
  2. go to your web site config it. Ex: http://example.org/tiki/

Reference:
https://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide
https://wiki.archlinux.org/index.php/RAID
https://wiki.archlinux.org/index.php/Postfix
https://wiki.archlinux.org/index.php/LAMP
https://wiki.archlinux.org/index.php/Gitlab

https://wiki.archlinux.org/index.php/Tomcat
https://doc.tiki.org/Installation

Leave a Reply

Your email address will not be published. Required fields are marked *