/ June 2016 ~ TI-UNPAM Angkatan18

Selamat Datang di Website Kelas TPLEI-Teknik Informatika UNPAM Angkatan XVIII

Universitas Pamulang

Pages

Saturday, June 18, 2016

How To Set Up and Use Yum Repositories on a CentOS 6 VPS

Introduction

YUM Repositories are warehouses of Linux software (RPM package files). RPM package file is a Red Hat Package Manager file and enables quick and easy software installation on Red Hat/CentOS Linux. YUM Repositories hold a number of RPM package files and enable download and installation of new software on our VPS. YUM Repositories can hold RPM package files locally (local disk) or remotely (FTP, HTTP or HTTPS). YUM Configuration files hold the information required to successfully find and install software (RPM packages files) on our VPS.
Most common and largest CentOS YUM Repositories:
Advantages of installing software from YUM Repositories are:
  • Easy Software Management - installing, updating, and deleting packages is simple
  • Software Dependency Resolution - software dependencies are automatically resolved and installed
  • Official Red Hat/CentOS Package Manager - YUM is official Red Hat/CentOS package manager
Sometimes the software we want to install on our CentOS VPS is not available from default Official CentOS Repositories. In situations like this, we can use one of the additional (Non-Official) CentOS YUM Repositories listed above. Additional repositories sometimes hold newer versions of software packages than Official CentOS Repositories.

YUM Repository Configuration File

We can install new software on Red Hat/CentOS Linux with "yum install packagename" command from console. Running this command first checks for existing YUM Repository configuration files in /etc/yum.repos.d/ directory. It reads each YUM Repository configuration file to get the information required to download and install new software, resolves software dependencies and installs the required RPM package files.
YUM Repository configuration files must:
  • be located in /etc/yum.repos.d/ directory
  • have .repo extension, to be recognized by YUM
Available YUM Repository configuration file options are:
  • Repository ID - One word unique repository ID (example: [examplerepo])
  • Name - Human readable name of the repository (example: name=Example Repository)
  • Baseurl - URL to the repodata directory. You can use file://path if repository is located locally or ftp://link, http://link, https://link if repository is located remotely - HTTP Authentication available http://user:password@www.repo1.com/repo1 (example: baseurl=http://mirror.cisp.com/CentOS/6/os/i386/)
  • Enabled - Enable repository when performing updates and installs (example: enabled=1)
  • Gpgcheck - Enable/disable GPG signature checking (example: gpgcheck=1)
  • Gpgkey - URL to the GPG key (example: gpgkey=http://mirror.cisp.com/CentOS/6/os/i386/RPM-GPG-KEY-CentOS-6)
  • Exclude - List of the packages to exclude (example: exclude=httpd,mod_ssl)
  • Includepkgs - List of the packages to include (example: include=kernel)
Required YUM Repository configuration file options are:
  • Repository ID
  • Name
  • Baseurl
  • Enabled

Step 1: Create YUM Repository configuration file

Use your favorite console text editor and create a new YUM Repository configuration file with .repo extension in /etc/yum.repos.d/ directory. To create a new file with "vi editor" run the following command from console:
vi /etc/yum.repos.d/example.repo

Step 2: Insert YUM Repository options

Insert the desired YUM Repository options to the newly created YUM Repository configuration file and save changes.

Example YUM Repository Configuration file:

/etc/yum.repos.d/example.repo

CentOS DVD ISO YUM Repository

CentOS DVD ISO holds a large number of software (RPM package files) which are available for installation during Red Hat/CentOS installation wizard. We can also use RPM package files from CentOS DVD ISO to create CentOS DVD ISO YUM Repository. This way we can install all of the software available on CentOS DVD ISO with "yum install packagename" command from VPS console even after we have completed Red Hat/CentOS installation wizard.

Step 1: Download/Transfer CentOS DVD ISO

CentOS DVD ISO files are available for download at http://mirror.centos.org/. We need to download or transfer CentOS DVD ISO to our VPS:
  • Transfer - If we have already downloaded CentOS DVD ISO to a machine different than our VPS, we will need to transfer it from our machine to our cloud server via FTP or SSH. We can do this with software like WinSCP (free SFTP client and FTP) or similar.
  • Download - We can download CentOS DVD ISO directly to our VPS with "wget" command from console (please change HTTP link accordingly):

Step 2: Mount CentOS DVD ISO

To view the CentOS DVD ISO data, we first need to mount it on desired location. We usually mount CD-ROM, USB devices or ISO files to /mnt directory (if free to use). To mount CentOS DVD ISO run the following command from console (please change /path/to/iso and /mnt accordingly):
mount -o loop /path/to/iso /mnt

Step 3: Create YUM Repository Configuration file

To start using the newly created Custom YUM Repository we must create YUM Repository Configuration file with .repo extension, which must be placed to /etc/yum.repos.d/ directory. Instructions to create YUM Repository Configuration file are covered in the first topic of this article called "YUM Repository Configuration File".

Example CentOS DVD ISO YUM Repository Configuration file:

/etc/yum.repos.d/centosdvdiso.repo
[centosdvdiso]
name=CentOS DVD ISO
baseurl=file:///mnt
enabled=1
gpgcheck=1
gpgkey=file:///mnt/RPM-GPG-KEY-CentOS-6

Custom YUM Repository

Sometimes we need to create a Custom YUM Repository (handy when the VPS has no internet connection). We can create a Custom YUM Repository from a desired number of selected RPM package files. Custom YUM Repository only holds the RPM package files we want to include in.

Step 1: Install "createrepo"

To create Custom YUM Repository we need to install additional software called "createrepo" on our cloud server. We can install "createrepo" by running the following command from console:
yum install createrepo

Step 2: Create Repository directory

We need to create a new directory that will be the location of our Custom YUM Repository and will hold the desired RPM package files. We can do this with the following command from console (choose a different /repository1 directory name if you like):
mkdir /repository1

Step 3: Put RPM files to Repository directory

If RPM package files are not yet present on our VPS we need to transfer them to our cloud server via FTP or SSH - use software like WinSCP (free SFTP client and FTP) or similar. We can also download RPM package files directly to our VPS (internet connection needed) with "wget" command from console (please change HTTP link accordingly):
If RPM files are already present on our VPS, we need to Copy or Move these files to the newly created directory from "Step 2". We can move RPM files with the following command from console (please change /path/to/rpm and /repository1 accordingly):
mv /path/to/rpm /repository1
We can copy RPM files with the following command from console (please change /path/to/rpm and /repository1 accordingly):
cp /path/to/rpm /repository1

Step 4: Run "createrepo"

Createrepo command reads through Custom YUM Repository directory from "Step 2" and creates a new directory called "repodata" in it. Repodata directory holds the metadata information for the newly created repository. Every time we add additional RPM package files to our Custom YUM Repository, we need to re-create Repository metadata with "createrepo" command. We can create new repository metadata by running the following command from console (please change /repository1 accordingly):
createrepo /repository1

Step 5: Create YUM Repository Configuration file

To start using the newly created Custom YUM Repository, we must create the corresponding YUM Repository Configuration file with .repo extension, which must be placed to /etc/yum.repos.d/ directory. Instructions to create YUM Repository Configuration file are covered in the first topic of this article called "YUM Repository Configuration File".

Example Custom YUM Repository Configuration file:

/etc/yum.repos.d/custom.repo
[customrepo]
name=Custom Repository
baseurl=file:///repository1/
enabled=1
gpgcheck=0
 
Source: https://www.digitalocean.com/community/tutorials/how-to-set-up-and-use-yum-repositories-on-a-centos-6-vps 

Wednesday, June 15, 2016

Installing CentOS 6.5 in VirtualBox

I have just installed CentOS 6.5 (minimal)  in Virtual Box on my Windows 8.1 pc. This is how I installed CentOS. Hope this helps.
[Update: The updated version of this article with screenshots for CentOS 6.7 can be found here.]
Requirements:
  1. CentOS 6.5 32-bit ISO : Download Link (~330 MB)
  2. Virtual Box : Download Link (~110 MB)
  3. Atleast 8 GB of free disk space.
Installation Procedure:
First, thing you need to  do is to set up your Virtual Box. Go ahead download and install Virtual Box (the download link is given above in the requirements).
Press “New“, Type Name as “CentOS 6.5 32 bit” or anything you want. Set the type as “Linux“, Version as “Red Hat 32 bit“. And press “Next”.
create vm
name and type of OS pic
Allocate RAM to 512 MB RAM or higher , then click “Next“.
select ram size pic
Then select the option “Create a virtual hard drive now “, then click on “Create“.
create hd pic
Select hard drive file type as the first option “VDI” , then click on “Next“.
hard disk type: vdi pic
Select type as “Dynamically allocated“. Choose the amount of hard disk space you want to allocate for your CentOS system. Select atleast 8Gb-10GB or higher and then click on “Create“.
VM HD size pic
Now, you would see the home screen of the Oracle Virtual box, Click on the CentOS VM you have created and then click “Start“.
start vm
Then click on the yellow folder icon and select the ISO file that you have downloaded.
Select ISO location
Then click on “Start“.
start boot
Wait for a few seconds and you will see the CentOS boot menu. Now, select the first option “Install or upgrade an existing system“.
Boot menu picture

[Note: To scroll through different options, you can either use the Arrow keys in your keyboard or the TAB key to move through different options . You may also use SPACE bar in your keyboard or ENTER key to make selections]
Now, you will probably get a message box saying “Disk Found” and if you want to verify the contents in the CD. Press “Skip”. If you need, you can press “OK” and verify the contents but it might take a while.
Using your arrow keys, select “Skip” and then hit “Enter“.
Disk check pic
loading screen
Hit “OK“.
CentOS Welcome
Now, select the language and then use the TAB key and then select “Ok” and hit ENTER.
select language
Now, select the model of the keyboardand then select “OK“.
keyboard selection pic
If you get a “Warning Message” such as the one below, just chooseRe-initialize all“.
Re-initialize all picture
Now, select your time zone and then hit “OK“. Then select a password for your “root” (or admin account), you can use TAB keys to reach the next box, and finally select “OK” and hit ENTER.
create root password
Now, select the option “Use entire drive“, and select “OK”.
allocate hard drive picture
Now, select “Write changes to disk” and the installer should start right up.
installation picture
installation progress pic
After, it is done installing , you will see a message saying “Congratulations, your CentOS installation is complete“. Select “Reboot” and hit ENTER.
installation complete -Reboot
Now, it should boot right up.
centos bootup picture
now, type login as: root , Then hit ENTER. Then type the password and hit ENTER. You should see now be able to see the terminal window with the # symbol.
root login pic

And voilà ! You have successfully installed CentOS 6.5 in Virtual Box.
This is a minimal mode CentOS and so many application packages are not installed. You will also have to configure the network to access the internet.
[UPDATE: To configure network in CentOS 6.5 (which is the same as configuring centos 6.3), I have made a detailed guide with screenshots, you can find it here.]
If you have any sort of queries on regarding this installation, just leave a comment and will get back at you. Don’t forget to follow my blog to get future updates!

source: https://extr3metech.wordpress.com/2014/09/04/installing-centos-6-5-in-virtualbox-minimal-screenshots/

Installing Virtual Box in Windows 7

Step 1: Installing Virtual Box in Windows 7

 

 
 
 
beagle4.jpg
Steps to install Virtual Box in Windows 7:

1) Go https://www.virtualbox.org/wiki/Downloads
2) Download Virtual Box (latest version) for Windows hosts x86/amd64
3) "Save As"
4) When done downloading, run the .exe
5) "Run" if Windows pops up a security warning
6) Continue with the installation of VirtualBox with the defaults

This will open VirtualBox at the end of the installation.  Please proceed to step 2.

Tuesday, June 14, 2016

How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x

This howto guide shows you’ll how to enable EPEL repository under RHEL/CentOS 6/5 to install additional standard open source packages by using YUM command.
Install EPEL Repository in Linux



Install EPEL Repository in Linux
Read Also : Install and Enable RPMForge Repository in RHEL/CentOS 7/6/5/4

What is EPEL

EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux. Epel project is not a part of RHEL/Cent OS but it is designed for major Linux distributions by providing lots of open source packages like networking, sys admin, programming, monitoring and so on. Most of the epel packages are maintained by Fedora repo.

Why we use EPEL repository?

  1. Provides lots of open source packages to install via Yum.
  2. Epel repo is 100% open source and free to use.
  3. It does not provide any core duplicate packages and no compatibility issues.
  4. All epel packages are maintained by Fedora repo.

How To Enable EPEL Repository in RHEL/CentOS 7/6/5?

First, you need to download the file using Wget and then install it using RPM on your system to enable the EPEL repository. Use below links based on your Linux OS versions. (Make sure you must be root user).

RHEL/CentOS 7 64 Bit

## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
# rpm -ivh epel-release-7-6.noarch.rpm

RHEL/CentOS 6 32-64 Bit

## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

RHEL/CentOS 5 32-64 Bit

## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm

## RHEL/CentOS 5 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm

RHEL/CentOS 4 32-64 Bit

## RHEL/CentOS 4 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm

## RHEL/CentOS 4 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/4/x86_64/epel-release-4-10.noarch.rpm
# rpm -ivh epel-release-4-10.noarch.rpm

Friday, June 10, 2016

Using MagicDisc to mount CD/DVD image

Using MagicDisc to mount CD/DVD image
You are here: Tutorials > Using MagicDisc to mount CD/DVD image.

  • Right click MagicDisc trayicon


     
  • Select "Virtual CD/DVD-ROM"


     
  • Select one of virtual CD/DVD drivers. (for examples: K: No Media)
  • Click "Mount"


     
  • Browse and select the CD/DVD image you wish to mount.
  • Click "Ok"

Reference:

Thursday, June 9, 2016

Apache SSL Certificate Installation

SSL Certificate Installation in Apache

If you have not yet created a Certificate Signing Request (CSR) and ordered your certificate, see
OpenSSL CSR Creation for Apache SSL or try our CSR Generator OpenSSL CSR Creation.
Apache Server SSL Certificate Installation
If you are installing an Extended Validation SSL Certificate, use our Apache EV SSL Certificate Installation Instructions. If you are installing any other certificate, follow the instructions below.
  1. Copy the Certificate files to your server.
    Download your Intermediate (DigiCertCA.crt) and Primary Certificate (your_domain_name.crt) files from your Customer Area, then copy them to the directory on your server where you will keep your certificate and key files. Make them readable by root only.
  2. Find the Apache config file to edit.
    The location and name of the config file can vary from server to server - especially if you use a special interface to manage your server configuration.
    Apache's main configuration file is typically named httpd.conf or apache2.conf. Possible locations for this file include /etc/httpd/ or /etc/apache2/. For a comprehensive listing of default installation layouts for Apache HTTPD on various operating systems and distributions, see Httpd Wiki - DistrosDefaultLayout.
    Often, the SSL Certificate configuration is located in a <VirtualHost> block in a different configuration file. The configuration files may be under a directory like /etc/httpd/vhosts.d/, /etc/httpd/sites/, or in a file called httpd-ssl.conf.
    One way to locate the SSL Configuration on Linux distributions is to search using grep, as shown in the example below.
    Type the following command:


    grep -i -r "SSLCertificateFile" /etc/httpd/
    Where "/etc/httpd/" is the base directory for your Apache installation.
  3. Identify the SSL <VirtualHost> block to configure.
    If you need your site to be accessible through both secure (https) and non-secure (http) connections, you will need a virtual host for each type of connection. Make a copy of the existing non-secure virtual host and configure it for SSL as described in step 4.
    If you only need your site to be accessed securely, configure the existing virtual host for SSL as described in step 4.
  4. Configure the <VirtualHost> block for the SSL-enabled site.
    Below is a very simple example of a virtual host configured for SSL. The parts listed in bold are the parts that must be added for SSL configuration:
    <VirtualHost 192.168.0.1:443>
    DocumentRoot /var/www/html2
    ServerName www.yourdomain.com
    SSLEngine on
    SSLCertificateFile /path/to/your_domain_name.crt
    SSLCertificateKeyFile /path/to/your_private.key
    SSLCertificateChainFile /path/to/DigiCertCA.crt

    </VirtualHost>
    Adjust the file names to match your certificate files:
    • SSLCertificateFile should be your DigiCert certificate file (eg. your_domain_name.crt).
    • SSLCertificateKeyFile should be the key file generated when you created the CSR.
    • SSLCertificateChainFile should be the DigiCert intermediate certificate file (DigiCertCA.crt) If the SSLCertificateChainFile directive does not work, try using the SSLCACertificateFile directive instead.
  5. Test your Apache config before restarting.
    It is always best to check your Apache config files for any errors before restarting, because Apache will not start again if your config files have syntax errors. Run the following command: (it is apache2ctl on some systems)
    apachectl configtest
  6. Restart Apache.
    You can use apachectl commands to stop and start Apache with SSL support:
    apachectl stop
    apachectl start

OpenSSL CSR Creation for Apache SSL


For other OS/Platform instructions, see SSL Certificate Installation Instructions & Tutorials.
How to generate a CSR for Apache using OpenSSL
Recommended: Save yourself some time by using our new OpenSSL CSR Wizard to create your apache ssl csr. Just fill in the details, click Generate, and paste your customized openssl command into your terminal. 

If you will be using Apache for Mac OS X server 10.5, see our Mac OS X CSR instructions. 

Preview of OpenSSL CSR Wizard

Of course if you prefer to build your own shell commands to generate your apache csr, just follow our old instructions below:
  1. Login to your server via your terminal client (ssh). At the prompt, type:
    openssl CSR generation command
    openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
    where server is the name of your server.

  2. This begins the process of generating two files: the Private-Key file for the decryption of your SSL Certificate, and a certificate signing request (CSR) file (used to apply for your SSL Certificate) with apache openssl.
    When you are prompted for the Common Name (domain name), enter the fully qualified domain name for the site you are securing. If you are generating an Apache CSR for a Wildcard SSL Certificate your common name should start with an asterisk (such as *.example.com).
    You will then be prompted for your organizational information, beginning with geographic information. There may be default information set already.
    This will then create your openssl .csr file.

  3. Open the CSR file with a text editor and copy and paste it (including the BEGIN and END tags) into the DigiCert Certificate order form.

  4. Save (backup) the generated .key file as it will be required later for Certificate installation.

  5. After you receive your SSL Certificate from DigiCert, you can install it.