Installing Jenkins CentOS

On RPM-based distributions, such as Red Hat Enterprise Linux (RHEL), CentOS, Fedora or Scientific Linux, you can install Jenkins through yum.

Recent versions are available in a YUM repository.

Installation

Add the Jenkins repository to the yum repos, and install Jenkins from here.

Installation of a stable version

There is also a LTS YUM repository for the LTS Release Line

Installation of Java

Jenkins requires Java in order to run, yet certain distros don’t include this by default. To install the Open Java Development Kit (OpenJDK) run the following:

sudo yum install java

Note: If running CentOS, ensure you follow the guide below.

Start/Stop

  • sudo service jenkins start/stop/restart
  • sudo chkconfig jenkins on

Note: if you get the following error message, ensure that Java has been installed:

Starting jenkins (via systemctl):  Job for jenkins.service failed. See 'systemctl status jenkins.service' and 'journalctl -xn' for details.
                                                           [FAILED]

What does this package do?

  • Jenkins will be launched as a daemon on startup. See /etc/init.d/jenkins for more details.
  • The ‘jenkins‘ user is created to run this service. If you change this to a different user via the config file, you must change the owner of /var/log/jenkins, /var/lib/jenkins, and /var/cache/jenkins.
  • Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
  • /etc/sysconfig/jenkins will capture configuration parameters for the launch.
  • By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.  Note that the built-in firewall may have to be opened to access this port from other computers.  (See http://www.cyberciti.biz/faq/disable-linux-firewall-under-centos-rhel-fedora/ for instructions how to disable the firewall permanently)
  • A Jenkins RPM repository is added in /etc/yum.repos.d/jenkins.repo

Disable the firewall

firewall-cmd --permanent --new-service=jenkins
firewall-cmd --permanent --service=jenkins --set-short="Jenkins Service Ports"
firewall-cmd --permanent --service=jenkins --set-description="Jenkins service firewalld port exceptions"
firewall-cmd --permanent --service=jenkins --add-port=8080/tcp
firewall-cmd --permanent --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-all

Important Note on CentOS Java

Jenkins requires Java in order to run, however yum install jenkins does not enforce that java is already installed. Check to make sure that you already hava java installed by running java -version. To further make things difficult for CentOS users, the default CentOS version of Java is not compatible with Jenkins. Jenkins typically works best with a Sun implementation of Java, which is not included in CentOS for licensing reasons.

If you get output similar to the following, it means you’re using the default (GCJ) version of Java, which will not work with Jenkins:

java -version
java version "1.7.0"
gij (GNU libgcj) version 4.4.6 20110731 (Red Hat 4.4.6-3)

To correct this, you may need to remove the GCJ version of Java and install a Sun-compatible version.

If you received the above output, uninstall the default java:

yum remove java

Then after you’ve uninstalled Java (or if you didn’t have Java installed at all to begin with). You need to install a Sun-compatible version of Java. The easiest approach is using OpenJDK, which is available through the EPEL repository (alternatively you may install an official RPM directly from Oracle). To install OpenJDK run the following:

yum install java-1.8.0-openjdk

Depending on your version of CentOS, the package name for OpenJDK may differ. Use yum search openjdk to check for the name of the package. If OpenJDK is not found at all through yum, you probably need to install the EPEL yum repository. After installation, you should be able to get the following output for java -version:

java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
Access the URL : http://<Ip-Address-of-your-Server>:8080

https://www.linuxtechi.com/install-configure-jenkins-on-centos-7-rhel-7/

https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions

How to Install RabbitMQ on CentOS 7

RabbitMQ is a widely used open-source message broker written in the Erlang programming language. As a message-oriented middleware, RabbitMQ can be used to implement the Advanced Message Queuing Protocol (AMQP) on all modern operating systems.

This article explains how to install RabbitMQ on a Vultr CentOS 7 server instance.

Prerequisites

Before getting started, you need to:

  • Deploy a brand new Vultr CentOS 7 server instance.
  • Log into the server as a non-root user with sudo privileges. You can learn about how to create such a sudo user in this Vultr article.

Step 1: Update the system

Use the following commands to update your CentOS 7 system to the latest stable status:

sudo yum install epel-release
sudo yum update
sudo reboot

Step 2: Install Erlang

Since RabbitMQ is written in Erlang, you need to install Erlang before you can use RabbitMQ:

cd ~
wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
sudo yum install erlang

Verify your installation of Erlang:

erl

You will be brought into the Erlang shell which resembles:

Erlang/OTP 18 [erts-7.3] [source-d2a6d81] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1>

Press Ctrl+C twice to quit the Erlang shell.

Step 3: Install RabbitMQ

Use the following commands to install the latest version of RabbitMQ which is 3.6.1 at the time of writing:

cd ~
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.1/rabbitmq-server-3.6.1-1.noarch.rpm
sudo rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo yum install rabbitmq-server-3.6.1-1.noarch.rpm

Step 4: Modify firewall rules

In order to access the RabbitMQ remote management console, you need to allow inbound TCP traffic on ports 4369, 25672, 5671, 5672, 15672, 61613, 61614, 1883, and 8883.

sudo firewall-cmd --zone=public --permanent --add-port=4369/tcp --add-port=25672/tcp --add-port=5671-5672/tcp --add-port=15672/tcp  --add-port=61613-61614/tcp --add-port=1883/tcp --add-port=8883/tcp
sudo firewall-cmd --reload

Start the RabbitMQ server and enable it to start on system boot:

sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

You can check the status of RabbitMQ with:

sudo rabbitmqctl status

Step 5: Enable and use the RabbitMQ management console

Enable the RabbitMQ management console so that you can monitor the RabbitMQ server processes from a web browser:

sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/

Next, you need to setup an administrator user account for accessing the RabbitMQ server management console. In the following commands, “mqadmin” is the administrator’s username, “mqadminpassword” is the password. Remember to replace them with your own ones.

sudo rabbitmqctl add_user mqadmin mqadminpassword
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*"

Now, visit the following URL:

http://[your-vultr-server-IP]:15672/

Log in with the credentials you had specified earlier. You will be greeted with the RabbitMQ remote management console, where you can learn more about RabbitMQ. Enjoy!

 

 

http://www.rabbitmq.com/tutorials/tutorial-one-php.html

Install Composer on CentOS

First you have to go to the /tmp directory

cd /tmp

Download the composer.phar file

curl -sS https://getcomposer.org/installer | php

Move it to /usr/local/bin/

mv composer.phar /usr/local/bin/composer

Now you can to use the command composer globally.

CentOS xdebug php72

http://xdebug.org/install.php#configure-php
Debugger Configuration Validation with PhpStorm
on CentOS: 1. You need to install PHP’s devel package for PHP commands execution yum install php-devel yum install php-pear 2. Next install GCC and GCC C++ compilers to compile Xdebug extension yourself. yum install gcc gcc-c++ autoconf automake 3. Compile Xdebug pecl install Xdebug 4. Find the php.ini file using locate php.ini And add the following line [xdebug] zend_extension="/usr/lib64/php/modules/xdebug.so" xdebug.remote_enable = 1 5. Restart Apache service httpd restart 6. Test if it works – create test.php with the following code phpinfo()

 

 

PHP72

 

yum install --enablerepo=epel,remi-php72   php-devel
yum install --enablerepo=epel,remi-php72  php-pear
yum install gcc gcc-c++ autoconf automake

nano /etc/php.ini
в конце добавляем

[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = 1


 
 pecl install xdebug
sudo systemctl restart php-fpm

 

 

В файлe php.ini добавить раздел [xdebug] с требуемыми параметрами, вот что  содержится в моем файле:

[xdebug]
xdebug.default_enable=on
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/tmp/xdebug_log.log"
xdebug.profiler_output_dir="/tmp"

 

 

В случае необходимости создать исключения для порта 9000:

 

semanage port -a -t http_port_t -p tcp 9000

Настраиваем NetBeans

  • Tools – Options – PHP
  • Вкладка General – для параметра PHP interpreter, указать /usr/bin/php, отметить параметры – Output Window, Web Browser
  • Вкладка Debugging – оставить все парамтры по умолчанию (Debugger – port 9000, Dession ID – netbeans-xdebug), убрать флажок с параметра Stop at First Line
  • В файл /usr/local/netbeans/etc/netbeans.conf добавить настройку параметра netbeans_default_options:

-J-Dorg.netbeans.modules.php.dbgp.level=400

 

 

SF 2 console if not work на самом сервере выполнить

export XDEBUG_CONFIG=”remote_host=192.168.80.254 idekey=PHPSTORM”
echo $XDEBUG_CONFIG

 

 

/etc/php/7.0/mods-available
sudo service php7.0-fpm restart
export XDEBUG_CONFIG=’remote_host=192.168.81.228 idekey=PHPSTORM’

export XDEBUG_CONFIG=’remote_host=localhost idekey=phpstorm’

Как настроить Xdebug в PhpStorm

https://freshnotes.org/2016/12/ustanovka-i-nastrojka-xdebug-phpstorm-v-ubuntu-16-04-elementary-os-0-4-loki-mint-18/

yum install

все нужные пакеты устанавливаются

yum --enablerepo=remi,remi-php72 install  **** название пакета *****

 

 

 

yum install gcc gcc-c++ autoconf automake

 

Next install GCC and GCC C++ compilers to compile Xdebug extension yourself.

yum install gcc gcc-c++ autoconf automake
yum --enablerepo=remi,remi-php72 install php-pecl-apcu php-cli php-pear \
 php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-memcache php-pecl-memcached \
 php-gd php-mbstring php-mcrypt php-xml

 

yum install curl-devel

 

ЭТО ПРОСТО ЗАМЕТА 

В CentOS,

Установите PHP Pear, если он еще не установлен:
# yum install php-pear

Установите GCC, если он еще не установлен:
# yum install gcc

Установите cURL, если он еще не установлен:
# yum install curl-devel

Установите следующую библиотеку, если она еще не установлена:
# yum install php-devel    # yum install zlib-devel    # yum install pcre-devel

Запустите основную установку:
# pecl install pecl_http

Добавьте следующую строку в файл /etc/php.ini расширение = raphf.so расширение = propro.so расширение = http.so
перезапустить сервер Apache, чтобы расширение можно было загрузить

 

в конце 

pecl install pecl_http

 

yum update
yum install php-devel gcc gcc-c++ autoconf automake
yum install php-pear
pecl install Xdebug
Then add the following line to the php.ini file:

zend_extension=/usr/lib64/php/modules/xdebug.so

https://sys-adm.in/os/nix/400-centos-install-xdebug-for-netbeans.html


http://xdebug.org/install.php#configure-php
Debugger Configuration Validation with PhpStorm
on CentOS: 1. You need to install PHP’s devel package for PHP commands execution yum install php-devel yum install php-pear 2. Next install GCC and GCC C++ compilers to compile Xdebug extension yourself. yum install gcc gcc-c++ autoconf automake 3. Compile Xdebug pecl install Xdebug 4. Find the php.ini file using locate php.ini And add the following line [xdebug] zend_extension="/usr/lib64/php/modules/xdebug.so" xdebug.remote_enable = 1 5. Restart Apache service httpd restart 6. Test if it works – create test.php with the following code <?php phpinfo() ?>

 

 

сервер

[root@vps-27610 ~]# history
    1  yum update
    2  yum install epel-release
    3  yum install nginx
    4  systemctl enable nginx
    5  systemctl start nginx
    6  rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
    7  yum install --enablerepo=epel,remi-php72 php php-mbstring
    8  yum install --enablerepo=epel,remi-php72  php-fpm
    9  systemctl start php-fpm
   10  systemctl enable php-fpm
   11  nano /etc/nginx/nginx.conf
   12  yum install nano
   13  yum install wget
   14  nano /etc/nginx/nginx.conf
   15  nginx -t
   16  systemctl restart nginx
   17  nano /etc/nginx/nginx.conf
   18  nano /usr/share/nginx/html/index.php
   19  yum install --enablerepo=epel,remi-php72   php-devel 
   20  yum install --enablerepo=epel,remi-php72  php-pear
   21  yum install gcc gcc-c++ autoconf automake
   22  nano /etc/php.ini
   23  sudo systemctl restart php-fpm
   24  pecl install xdebug
   25  sudo systemctl restart php-fpm
   26  nano /etc/php.ini
   27  sudo systemctl restart php-fpm
   28  nano /etc/php.d/15-xdebug.ini
   29  cd  /etc/php.d/
   30  ls
   31  nano /etc/php.d/15-xdebug.ini
   32  nano /etc/php.ini
   33  sudo systemctl restart php-fpm
   34  history
[root@vps-27610 ~]#

GIT

You can use WANDisco's CentOS repository to install Git 2.x: for CentOS 6, for CentOS 7

Install WANDisco repo package:

yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
- or -
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
- or -
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
Install the latest version of Git 2.x:

yum install git
Verify the version of Git that was installed:

git --version

Installing MySQL CentOS 7

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7

Introduction

MySQL is an open-source database management system, commonly installed as part of the popular LEMP(Linux, Nginx, MySQL/MariaDB, PHP/Python/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its data.

CentOS 7 prefers MariaDB, a fork of MySQL managed by the original MySQL developers and designed as a replacement for MySQL. If you run yum install mysql on CentOS 7, it is MariaDB that is installed rather than MySQL. If you’re wondering about MySQL vs. MariaDB, MariaDB will generally work seamlessly in place of MySQL, so unless you have a specific use-case for MySQL, see the How To Install MariaDB on Centos 7 guide.

This tutorial will explain how to install MySQL version 5.7 on a CentOS 7 server.

Prerequisites

To follow this tutorial, you will need:

  • A CentOS 7 with a non-root user with sudo privileges. You can learn more about how to set up a user with these privileges in the Initial Server Setup with CentOS 7 guide.

Step 1 — Installing MySQL

As mentioned in the introduction, the Yum command to install MySQL in fact installs MariaDB. To install MySQL, we’ll need to visit the MySQL community Yum Repository which provides packages for MySQL.

In a web browser, visit:

 

https://dev.mysql.com/downloads/repo/yum/

Note that the prominent Download links don’t lead directly to the files. Instead, they lead to a subsequent page where you’re invited to log in or sign up for an account. If you don’t want to create an account, you can locate the text “No thanks, just start my download”, then right-click and copy the link location, or you can edit the version number in the commands below.

Locate the desired version, and update it as needed in the link below:

  

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

Once the rpm file is saved, we will verify the integrity of the download by running md5sum and comparing it with the corresponding MD5 value listed on the site:

md5sum mysql57-community-release-el7-9.noarch.rpm

Output
1a29601dc380ef2c7bc25e2a0e25d31e  mysql57-community-release-el7-9.noarch.rpm

 

Compare this output with the appropriate MD5 value on the site:

 

Now that we’ve verified that the file wasn’t corrupted or changed, we’ll install the package:

 

sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm

This adds two new MySQL yum repositories, and we can now use them to install MySQL server:

sudo yum install mysql-server

Press y to confirm that you want to proceed. Since we’ve just added the package, we’ll also be prompted to accept its GPG key. Press y to download it and complete the install.

Step 2 — Starting MySQL

We’ll start the daemon with the following command:

sudo systemctl start mysqld

systemctl doesn’t display the outcome of all service management commands, so to be sure we succeeded, we’ll use the following command:

sudo systemctl status mysqld

If MySQL has successfully started, the output should contain Active: active (running) and the final line should look something like:

Dec 01 19:02:20 centos-512mb-sfo2-02 systemd[1]: Started MySQL Server.
[
Note: MySQL is automatically enabled to start at boot when it is installed. You can change that default behavior with 
sudo systemctl disable mysqld 
]

 

During the installation process, a temporary password is generated for the MySQL root user. Locate it in the mysqld.log with this command:

sudo grep 'temporary password' /var/log/mysqld.log
Output
2016-12-01T00:22:31.416107Z 1 [Note] A temporary password is generated for root@localhost: mqRfBU_3Xk>r

Make note of the password, which you will need in the next step to secure the installation and where you will be forced to change it. The default password policy requires 12 characters, with at least one uppercase letter, one lowercase letter, one number and one special character.

Step 3 — Configuring MySQL

MySQL includes a security script to change some of the less secure default options for things like remote root logins and sample users.

Use this command to run the security script.

sudo mysql_secure_installation

This will prompt you for the default root password. As soon as you enter it, you will be required to change it.

Output
The existing password for the user account root has expired. Please set a new password.

New password:

Enter a new 12-character password that contains at least one uppercase letter, one lowercase letter, one number and one special character. Re-enter it when prompted.

You’ll receive feedback on the strength of your new password, and then you’ll be immediately prompted to change it again. Since you just did, you can confidently say No:

 

 

Output
Estimated strength of the password: 100
Change the password for root ? (Press y|Y for Yes, any other key for No) :

 

After we decline the prompt to change the password again, we’ll press Y and then ENTER to all the subsequent questions in order to remove anonymous users, disallow remote root login, remove the test database and access to it, and reload the privilege tables.

Now that we’ve secured the installation, let’s test it.

Step 4 — Testing MySQL

We can verify our installation and get information about it by connecting with the mysqladmin tool, a client that lets you run administrative commands. Use the following command to connect to MySQL as root(-u root), prompt for a password (-p), and return the version.

mysqladmin -u root -p version

You should see output similar to this:

 

Output
mysqladmin  Ver 8.42 Distrib 5.7.16, for Linux on x86_64
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          5.7.16
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 2 min 17 sec

Threads: 1  Questions: 6  Slow queries: 0  Opens: 107  Flush tables: 1  Open tables: 100  Queries per second avg: 0.043

 

This indicates your installation has been successful.