Centos Nginx ve Git Kurulumu
Dijitalocean üzerinde popüler linux dağıtımlarının sistem image leri var.
Bu imagesler ile Birkaç dakilka içerisinde VPS (Virtual Private Server) oluşturup kullanıma hazır hale gerilmekte.
Bloğumda Git kurulumu konusunda yardım isteyen zafer bey için hemde Benim için tecrübe olacağını düşündüğümden Centos droplet oluşturdum.
Elbette oluşturduğum Droplet fazla uzun ömürlü olmayacak. sanırım bu gece silerim kendisini 🙂
Zafer bey ile e-posta yazışmalarında Centos üzerinde Nginx kullandığını ve Git için gitweb kurulumuna ihtiyacı olduğunu belirtti.
Bende Daha önceki yazımda işe Rasppberry Pi üzerinde Pratik Gitweb kurulumunu anlatmıştım. Sistemler farklı oluğundan zafer bey gitweb Kurulumunu yapamamış.
Bende hafta sonunu değerlendirmek için bu çalışmayı yaptım.
Girizgahı fazla uzatmadan Yaptığım işlemleri anlatayım.
Centos bilindiği gibi Yum paket yönecisini kullanmaktadır.
Yazıda hazır Droplet kullandığım için üzerinde kurulu hemen hemen hiçbir şey yok.
Bu nedenle tüm gerekli paketleri bizim kurmamız gerekli.
Öncelikle sistemi güncelleyelim.
Daha Sonra Nginx ve Bizim için gerekli olan paketleri kurmamızı sağlayacak EPEL deposunu ekleyelim.
1 2 3 4 5 6 7 8 9 10 | [root@centos-7-x64 ~]# yum -y update [root@centos-7-x64 ~]# yum -y install epel-release Loaded plugins: fastestmirror ..... Installed: epel-release.noarch 0:7-5 Complete! [root@centos-7-x64 ~]# |
Bu adımdan sonra paketlerimizi kuralım.
1 | [root@centos-7-x64 ~]# yum -y install nginx |
Gitweb Perl ile yazıldığından Nginx tarafında gerekli spawn-fcgi paketinı kuralım.
1 | [root@centos-7-x64 ~]# yum -y install spawn-fcgi |
Gitweb için gerekli olan fcgiwrap paketini derleyip sisteme kurmamız gerekli.
Link. https://www.howtoforge.com/perfect-server-centos-6.1-x86_64-with-nginx-ispconfig-3-p5
bunun için daha önce sistemimizde kurulu bulunmayan Development Tools grup paketlerin kurmalıyız.
Önce paket grup listelerini alalım.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [root@centos-7-x64 ~]# yum grouplist Loaded plugins: fastestmirror Available Groups: ...... CIFS file server Compatibility Libraries Console Internet Tools Desktop Desktop Platform Desktop Platform Development Development Tools Eclipse ..... [root@centos-7-x64 ~]# |
Biz Development Tools paketini kurarken Git Paketide kuruluyor. Yani ayrıca Git kurmamız gerekmiyor 😀
1 2 3 4 5 6 7 | [root@centos-7-x64 ~]# yum -y groupinstall "Development Tools" Loaded plugins: fastestmirror ........ ....... Complete! [root@centos-7-x64 ~]# |
Şimdi spawn-fcgi socket oluşturması için wrapper yazmamız gerekli.
1 | nano /etc/sysconfig/spawn-fcgi |
Açılan dosyanın içeriğini düzenleyin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # You must set some working options before the "spawn-fcgi" service will work. # If SOCKET points to a file, then this file is cleaned up by the init script. # # See spawn-fcgi(1) for all possible options. # # Example : #SOCKET=/var/run/php-fcgi.sock #OPTIONS="-u nginx -g nginx -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi.pid -- /usr/bin/php-cgi" FCGI_SOCKET=/var/run/fcgiwrap.socket FCGI_PROGRAM=/usr/local/sbin/fcgiwrap FCGI_USER=nginx FCGI_GROUP=nginx FCGI_EXTRA_OPTIONS="-M 0770" OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM" # bitiş |
Başlangıç servislerine ekleyelim
1 2 3 4 | [root@truvacloud ~]# chkconfig --levels 235 nginx on Note: Forwarding request to 'systemctl enable nginx.service'. ln -s '/usr/lib/systemd/system/nginx.service' '/etc/systemd/system/multi-user.target.wants/nginx.service' [root@truvacloud ~]# chkconfig --levels 235 spawn-fcgi on |
gerekli servisler start oluyormu kontrol amaçlı olarak
sistemi yeniden başlatalım.
1 | [root@truvacloud ~]# reboot |
Gitweb paketini kuralım Devel Paketleri ile kurulmamış.
Not: Debian da default olarak git ile beraber kurulmaktadır.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | [root@truvacloud ~]# yum -y install gitweb Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.imt-systems.com * epel: mirror.23media.de ..... --> Finished Dependency Resolution Dependencies Resolved ....... Install 1 Package (+2 Dependent packages) ........... Installed: gitweb.noarch 0:1.8.3.1-4.el7 ........... Complete! [root@truvacloud ~]# |
Şimdi sırada fcgiwrap kurulumu var:
Link : http://klofver.tumblr.com/post/43260701373/install-gitweb-on-nginx
1 2 3 4 5 6 7 8 | $ cd /usr/local/src/ $ git clone git://github.com/gnosek/fcgiwrap.git $ cd fcgiwrap $ yum install fcgi-devel make automake autoconf $ autoreconf -i $ ./configure $ make $ make install |
Önce Paket kaynağını indirelim.
1 2 3 4 5 6 7 8 | [root@truvacloud ~]# cd [root@truvacloud ~]# git clone git://github.com/gnosek/fcgiwrap.git Cloning into 'fcgiwrap'... remote: Counting objects: 270, done. remote: Total 270 (delta 0), reused 0 (delta 0), pack-reused 270 Receiving objects: 100% (270/270), 62.89 KiB | 0 bytes/s, done. Resolving deltas: 100% (139/139), done. [root@truvacloud ~]# |
Kuralım
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | [root@truvacloud fcgiwrap]# autoreconf -i [root@truvacloud fcgiwrap]# ./configure checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for FCGX_Init in -lfcgi... no configure: error: FastCGI library is missing [root@truvacloud fcgiwrap]# |
Ops hata verdi 🙂
fcgi-devel paketini kurmamışım 😀
1 2 3 4 5 6 7 8 | [root@truvacloud fcgiwrap]# yum install fcgi-devel make automake autoconf -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.imt-systems.com * epel: mirror.23media.de ..... Complete! [root@truvacloud fcgiwrap]# |
Şimdi yeniden Başlayalım.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | [root@truvacloud fcgiwrap]# autoreconf -i [root@truvacloud fcgiwrap]# ./configure checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for FCGX_Init in -lfcgi... yes checking for systemd... no checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking for stdbool.h that conforms to C99... yes checking for _Bool... yes checking for pid_t... yes checking for size_t... yes checking for ssize_t... yes checking vfork.h usability... no checking vfork.h presence... no checking for vfork.h... no checking for fork... yes checking for vfork... yes checking for working fork... yes checking for working vfork... (cached) yes checking whether lstat correctly handles trailing slash... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible malloc... yes checking for strchr... yes checking for strdup... yes checking for strrchr... yes checking for dup2... yes checking for putenv... yes checking for select... yes checking for setenv... yes checking for strerror... yes configure: creating ./config.status config.status: creating Makefile config.status: creating config.h [root@truvacloud fcgiwrap]# |
Şimdi Derleyip Kuralım.
1 2 3 4 5 6 7 8 9 | [root@truvacloud fcgiwrap]# make cc -std=gnu99 -Wall -Wextra -Werror -pedantic -O2 -g3 fcgiwrap.c -lfcgi -o fcgiwrap [root@truvacloud fcgiwrap]# [root@truvacloud fcgiwrap]# make install install -d -m 755 /usr/local/sbin install -m 755 fcgiwrap /usr/local/sbin install -d -m 755 /usr/local/man/man8 install -m 644 fcgiwrap.8 /usr/local/man/man8 [root@truvacloud fcgiwrap]# |
Gitweb Yapılandırma Dosyasını Düzenleyelim.
1 | [root@truvacloud fcgiwrap]# nano /etc/gitweb.conf |
Projlerinizin bulunduğu yeri belirten bu satırı düzenleyin.
1 | our $projectroot = “/home/git/” |
Gitweb için Nginx Yapılandırma dosyası subdomain olarak çalışacak şekilde. Örnekte adres olarak: git.example.com
1 | [root@truvacloud fcgiwrap]# nano /etc/nginx/conf.d/00-gitweb.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | server { server_name git.example.com; listen 80; access_log /var/log/nginx/gitweb.access.log; error_log /var/log/nginx/gitweb.error.log; charset utf-8; location /gitweb.cgi { fastcgi_pass unix:/run/fcgiwrap.socket; fastcgi_param PATH_INFO $uri; fastcgi_param GITWEB_CONFIG /etc/gitweb.conf; fastcgi_param SCRIPT_FILENAME /var/www/git/gitweb.cgi; include fastcgi_params; } location / { root /var/www/git/; index gitweb.cgi; } } |
Son olarak sizinde sistemi denemeniz için centos dropleti açık bırakacağım.
sunucu ip adresi 46.101.204.41
eğer gitweb arayüzünü görebilmek istiyorsanız
kendi sisteminizde /etc/hosts dosyasına bu satırı ekleyip kaydedin.
1 | 46.101.204.41 git.example.com |
Tarayınıcınız adres satırına git.example.com yazın.
iyi eğlenceler.
Not: 28 Kasım 2015 Saat: 22:00 itibarı ile Droplet silinmiştir.
Eline sağlık, detaylı ve güzel bir anlatım olmuş ancak bir o kadarda korkutucu 🙂 Linux’un bu özelliğini sevmiyorum, altı üstü kuracağımız küçük bir uygulama ancak burun için kod derleme ve hata ayıklama sürecine kadar gidiyoruz. PPA depoları sayesinde bu sıkıntı azalmış olsada halen insanın karşısına çıkıyor.
Bu konuda çok deneyimim olmadğı için henüz bir deneme yapmadım. Bir sanal makine kurup onun üzerinde deneme yapmayı planlıyorum. Tekrardan çok teşekkür ederim.
Rica ederim.