1. 설정 파일 

* 설정 파일 위치

/etc/sysconfig/jenkins


* 웹 서비스 Port 변경

# vi /etc/sysconfig/jenkins

JENKINS_PORT="8081"

JENKINS_AJP_PORT="8010"



2. 웹 콘솔

* 사용자 등록(사용자 등록 후 보안 설정이 가능)

jenkins 관리 -> Manage Users -> 사용자 생성에서 사용자 및 admin 등록


* 보안 및 권한 설정

jenkins 관리 -> configure global security







'IDE & Build > Jenkins' 카테고리의 다른 글

jenkins - war 파일 배포  (0) 2013.06.08
jenkins - subversion post-commit hook 설정 및 troubleshooting  (0) 2013.06.08
jenkins - installation and update  (0) 2013.06.05
hudson과 jenkins  (0) 2012.04.25
hudson - 참고 사이트  (0) 2012.04.14
Posted by linuxism
,


update - 2015.06.27


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 --zone=public --add-port=8080/tcp --permanent
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.5.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.6.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
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.6) (rhel-1.43.1.10.6.el6_2-i386)
OpenJDK Client VM (build 20.0-b11, mixed mode)
OpenJDK Client VM (build 20.0-b11, mixed mode)



source - https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions#InstallingJenkinsonRedHatdistributions-ImportantNoteonCentOSJava








selinux port 관련 참조 - http://linuxism.tistory.com/1949







* jenkins update

# yum update jenkins 


* log

# tail -f /var/log/jenkins/jenkins.log

'IDE & Build > Jenkins' 카테고리의 다른 글

jenkins - subversion post-commit hook 설정 및 troubleshooting  (0) 2013.06.08
jenkins - 설정  (0) 2013.06.05
hudson과 jenkins  (0) 2012.04.25
hudson - 참고 사이트  (0) 2012.04.14
Hudson master/slave 구성  (0) 2012.04.13
Posted by linuxism
,

* fedora 23 : $releasever = 7


2016.02.21

Install MongoDB Community Edition on Red Hat Enterprise or CentOS Linux

Overview

Use this tutorial to install MongoDB Community Edition on Red Hat Enterprise Linux or CentOS Linux versions 6 and 7 using .rpm packages. While some of these distributions include their own MongoDB packages, the official MongoDB Community Edition packages are generally more up to date.

PLATFORM SUPPORT

This installation guide only supports 64-bit systems. See Platform Support for details.

MongoDB 3.2 deprecates support for Red Hat Enterprise Linux 5.

Packages

MongoDB provides officially supported packages in their own repository. This repository contains the following packages:

mongodb-orgmetapackage that will automatically install the four component packages listed below.
mongodb-org-serverContains the mongod daemon and associated configuration and init scripts.
mongodb-org-mongosContains the mongos daemon.
mongodb-org-shellContains the mongo shell.
mongodb-org-toolsContains the following MongoDB tools: mongoimport bsondumpmongodump,mongoexportmongofilesmongooplogmongoperfmongorestoremongostat, and mongotop.

The default /etc/mongod.conf configuration file supplied by the packages have bind_ip set to127.0.0.1 by default. Modify this setting as needed for your environment before initializing a replica set.

Init Scripts

The mongodb-org package includes various init scripts, including the init script/etc/rc.d/init.d/mongod. You can use these scripts to stop, start, and restart daemon processes.

The package configures MongoDB using the /etc/mongod.conf file in conjunction with the init scripts. See the Configuration File reference for documentation of settings available in the configuration file.

As of version 3.2.3, there are no init scripts for mongos. The mongos process is used only in sharding. You can use the mongod init script to derive your own mongos init script for use in such environments. See themongos reference for configuration details.

The default /etc/mongod.conf configuration file supplied by the packages have bind_ip set to127.0.0.1 by default. Modify this setting as needed for your environment before initializing a replica set.

Install MongoDB Community Edition

NOTE

To install a version of MongoDB prior to 3.2, please refer to that version’s documentation. For example, see version 3.0.

This installation guide only supports 64-bit systems. See Platform Support for details.

1

Configure the package management system (yum).

Create a /etc/yum.repos.d/mongodb-org-3.2.repo file so that you can install MongoDB directly, using yum.

Changed in version 3.0: MongoDB Linux packages are in a new repository beginning with 3.0.

For the latest stable release of MongoDB

Use the following repository file:

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1

For versions of MongoDB earlier than 3.0

To install the packages from an earlier release series, such as 2.4 or 2.6, you can specify the release series in the repository configuration. For example, to restrict your system to the 2.6 release series, create a /etc/yum.repos.d/mongodb-org-2.6.repo file to hold the following configuration information for the MongoDB 2.6 repository:

[mongodb-org-2.6]
name=MongoDB 2.6 Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

You can find .repo files for each release in the repository itself. Remember that odd-numbered minor release versions (e.g. 2.5) are development versions and are unsuitable for production use.

2

Install the MongoDB packages and associated tools.

When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.

To install the latest stable version of MongoDB, issue the following command:

sudo yum install -y mongodb-org

To install a specific release of MongoDB, specify each component package individually and append the version number to the package name, as in the following example:

sudo yum install -y mongodb-org-3.2.3 mongodb-org-server-3.2.3 mongodb-org-shell-3.2.3 mongodb-org-mongos-3.2.3 mongodb-org-tools-3.2.3

You can specify any available version of MongoDB. However yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file:

exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

Run MongoDB Community Edition

Prerequisites

Configure SELinux

IMPORTANT

You must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).

To configure SELinux, administrators have three options:

NOTE

All three options require root privileges. The first two options each requires a system reboot and may have larger implications for your deployment.

  • Disable SELinux entirely by changing the SELINUX setting to disabled in/etc/selinux/config.

    SELINUX=disabled
    
  • Set SELinux to permissive mode in /etc/selinux/config by changing the SELINUX setting to permissive .

    SELINUX=permissive
    

    NOTE

    You can use setenforce to change to permissive mode; this method does not require a reboot but is not persistent.

  • Enable access to the relevant ports (e.g. 27017) for SELinux if in enforcing mode. See Default MongoDB Port for more information on MongoDB’s default ports. For default settings, this can be accomplished by running

    semanage port -a -t mongod_port_t -p tcp 27017
    

    WARNING

    On RHEL 7.0, if you change the data path, the default SELinux policies will prevent mongod from having write access on the new data path if you do not change the security context.

You may alternatively choose not to install the SELinux packages when you are installing your Linux operating system, or choose to remove the relevant packages. This option is the most invasive and is not recommended.

Data Directories and Permissions

WARNING

On RHEL 7.0, if you change the data path, the default SELinux policies will prevent mongod from having write access on the new data path if you do not change the security context.

The MongoDB instance stores its data files in /var/lib/mongo and its log files in /var/log/mongodbby default, and runs using the mongod user account. You can specify alternate log and data file directories in/etc/mongod.conf. See systemLog.path and storage.dbPath for additional information.

If you change the user that runs the MongoDB process, you must modify the access control rights to the/var/lib/mongo and /var/log/mongodb directories to give this user access to these directories.

Procedure

1

Start MongoDB.

You can start the mongod process by issuing the following command:

sudo service mongod start
2

Verify that MongoDB has started successfully

You can verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading

[initandlisten] waiting for connections on port <port>

where <port> is the port configured in /etc/mongod.conf27017 by default.

You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:

sudo chkconfig mongod on
3

Stop MongoDB.

As needed, you can stop the mongod process by issuing the following command:

sudo service mongod stop
4

Restart MongoDB.

You can restart the mongod process by issuing the following command:

sudo service mongod restart

You can follow the state of the process for errors or important messages by watching the output in the/var/log/mongodb/mongod.log file.

5

Begin using MongoDB.

To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started for the available editions.

Before deploying MongoDB in a production environment, consider the Production Notes document.

Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running.

Uninstall MongoDB Community Edition

To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.

WARNING

This process will completely remove MongoDB, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.

1

Stop MongoDB.

Stop the mongod process by issuing the following command:

sudo service mongod stop
2

Remove Packages.

Remove any MongoDB packages that you had previously installed.

sudo yum erase $(rpm -qa | grep mongodb-org)
3

Remove Data Directories.

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo



source - https://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat/








Install MongoDB on Red Hat Enterprise or CentOS Linux

Overview

Use this tutorial to install MongoDB on Red Hat Enterprise Linux or CentOS Linux versions 5, 6, and 7 using.rpm packages. While some of these distributions include their own MongoDB packages, the official MongoDB packages are generally more up to date.

PLATFORM SUPPORT

This installation guide only supports 64-bit systems. See Platform Support for details.

Packages

MongoDB provides officially supported packages in their own repository. This repository contains the following packages:

Init Scripts

The mongodb-org package includes various init scripts, including the init script/etc/rc.d/init.d/mongod. These scripts are used to stop, start, and restart daemon processes.

The package configures MongoDB using the /etc/mongod.conf file in conjunction with the init scripts. See the Configuration File reference for documentation of settings available in the configuration file.

As of version 3.2.0, there are no init scripts for mongos. The mongos process is used only in sharding. You can use the mongod init script to derive your own mongos init script for use in such environments. See themongos reference for configuration details.

Considerations

This installation guide only supports 64-bit systems. See Platform Support for details.

The default /etc/mongod.conf configuration file supplied by the 3.0 series packages has bind_ip set to 127.0.0.1 by default. Modify this setting as needed for your environment before initializing a replica set.

Changed in version 2.6: The package structure and names have changed as of version 2.6. For instructions on installation of an older release, please refer to the documentation for the appropriate version.

Install MongoDB

1

Configure the package management system (yum).

Create a /etc/yum.repos.d/mongodb-org-3.2.repo file so that you can install MongoDB directly, using yum.

Changed in version 3.0: MongoDB Linux packages are in a new repository beginning with 3.0.

For the latest stable release of MongoDB

Use the following repository file:

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1

* fedora 23 : $releasever = 7


For versions of MongoDB earlier than 3.0

To install the packages from an earlier release series, such as 2.4 or 2.6, you can specify the release series in the repository configuration. For example, to restrict your system to the 2.6 release series, create a /etc/yum.repos.d/mongodb-org-2.6.repo file to hold the following configuration information for the MongoDB 2.6 repository:

[mongodb-org-2.6]
name=MongoDB 2.6 Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

You can find .repo files for each release in the repository itself. Remember that odd-numbered minor release versions (e.g. 2.5) are development versions and are unsuitable for production use.

2

Install the MongoDB packages and associated tools.

When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.

To install the latest stable version of MongoDB, issue the following command:

sudo yum install -y mongodb-org

To install a specific release of MongoDB, specify each component package individually and append the version number to the package name, as in the following example:

sudo yum install -y mongodb-org-3.2.0 mongodb-org-server-3.2.0 mongodb-org-shell-3.2.0 mongodb-org-mongos-3.2.0 mongodb-org-tools-3.2.0

You can specify any available version of MongoDB. However yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file:

exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

Versions of the MongoDB packages before 2.6 use a different repo location. Refer to the version of the documentation appropriate for your MongoDB version.

Run MongoDB

Prerequisites

Configure SELinux

IMPORTANT

You must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux or CentOS Linux).

To configure SELinux, administrators have three options:

NOTE

All three options require root privileges. The first two options each requires a system reboot and may have larger implications for your deployment.

  • Disable SELinux entirely by changing the SELINUX setting to disabled in/etc/selinux/config.

    SELINUX=disabled
    
  • Set SELinux to permissive mode in /etc/selinux/config by changing the SELINUX setting to permissive .

    SELINUX=permissive
    

    NOTE

    You can use setenforce to change to permissive mode; this method does not require a reboot but is not persistent.

  • Enable access to the relevant ports (e.g. 27017) for SELinux if in enforcing mode. See Default MongoDB Port for more information on MongoDB’s default ports. For default settings, this can be accomplished by running

    semanage port -a -t mongod_port_t -p tcp 27017
    

    WARNING

    On RHEL 7.0, if you change the data path, the default SELinux policies will prevent mongod from having write access on the new data path if you do not change the security context.

You may alternatively choose not to install the SELinux packages when you are installing your Linux operating system, or choose to remove the relevant packages. This option is the most invasive and is not recommended.

Data Directories and Permissions

WARNING

On RHEL 7.0, if you change the data path, the default SELinux policies will prevent mongod from having write access on the new data path if you do not change the security context.

The MongoDB instance stores its data files in /var/lib/mongo and its log files in /var/log/mongodbby default, and runs using the mongod user account. You can specify alternate log and data file directories in/etc/mongod.conf. See systemLog.path and storage.dbPath for additional information.

If you change the user that runs the MongoDB process, you must modify the access control rights to the/var/lib/mongo and /var/log/mongodb directories to give this user access to these directories.

Procedure

1

Start MongoDB.

You can start the mongod process by issuing the following command:

sudo service mongod start
2

Verify that MongoDB has started successfully

You can verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading

[initandlisten] waiting for connections on port <port>

where <port> is the port configured in /etc/mongod.conf27017 by default.

You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:

sudo chkconfig mongod on
3

Stop MongoDB.

As needed, you can stop the mongod process by issuing the following command:

sudo service mongod stop
4

Restart MongoDB.

You can restart the mongod process by issuing the following command:

sudo service mongod restart

You can follow the state of the process for errors or important messages by watching the output in the/var/log/mongodb/mongod.log file.

5

Begin using MongoDB.

To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started for the available editions.

Before deploying MongoDB in a production environment, consider the Production Notes document.

Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running.

Uninstall MongoDB

To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.

WARNING

This process will completely remove MongoDB, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.

1

Stop MongoDB.

Stop the mongod process by issuing the following command:

sudo service mongod stop
2

Remove Packages.

Remove any MongoDB packages that you had previously installed.

sudo yum erase $(rpm -qa | grep mongodb-org)
3

Remove Data Directories.

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongo



source - https://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat/








# mongo

MongoDB shell version: 3.2.0

connecting to: test

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

http://docs.mongodb.org/

Questions? Try the support group

http://groups.google.com/group/mongodb-user

Server has startup warnings: 

2016-01-02T22:19:40.051+0900 I CONTROL  [initandlisten] 

2016-01-02T22:19:40.051+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2016-01-02T22:19:40.051+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2016-01-02T22:19:40.051+0900 I CONTROL  [initandlisten]



Disable Transparent Huge Pages (THP)

Transparent Huge Pages (THP) is a Linux memory management system that reduces the overhead of Translation Lookaside Buffer (TLB) lookups on machines with large amounts of memory by using larger memory pages.

However, database workloads often perform poorly with THP, because they tend to have sparse rather than contiguous memory access patterns. You should disable THP on Linux machines to ensure best performance with MongoDB.

Init Script

IMPORTANT

If you are using tuned or ktune (for example, if you are running Red Hat or CentOS 6+), you must additionally configure them so that THP is not re-enabled. See Using tuned and ktune.

1

Create the init.d script.

Create the following file at /etc/init.d/disable-transparent-hugepages:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          disable-transparent-hugepages
# Required-Start:    $local_fs
# Required-Stop:
# X-Start-Before:    mongod mongodb-mms-automation-agent
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description:       Disable Linux transparent huge pages, to improve
#                    database performance.
### END INIT INFO

case $1 in
  start)
    if [ -d /sys/kernel/mm/transparent_hugepage ]; then
      thp_path=/sys/kernel/mm/transparent_hugepage
    elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
      thp_path=/sys/kernel/mm/redhat_transparent_hugepage
    else
      return 0
    fi

    echo 'never' > ${thp_path}/enabled
    echo 'never' > ${thp_path}/defrag

    unset thp_path
    ;;
esac
2

Make it executable.

Run the following command to ensure that the init script can be used:

sudo chmod 755 /etc/init.d/disable-transparent-hugepages
3

Configure your operating system to run it on boot.

Use the appropriate command to configure the new init script on your Linux distribution.

DistributionCommand
Ubuntu and Debian
sudo update-rc.d disable-transparent-hugepages defaults
SUSE
sudo insserv /etc/init.d/disable-transparent-hugepages
Red Hat, CentOS, Amazon Linux, and derivatives
sudo chkconfig --add disable-transparent-hugepages
4

Override tuned and ktune, if applicable

If you are using tuned or ktune (for example, if you are running Red Hat or CentOS 6+) you must now configure them to preserve the above settings.

Using tuned and ktune

IMPORTANT

If using tuned or ktune, you must perform this step in addition to installing the init script.

tuned and ktune are dynamic kernel tuning tools available on Red Hat and CentOS that can disable transparent huge pages.

To disable transparent huge pages in tuned or ktune, you need to edit or create a new profile that sets THP to never.

Red Hat/CentOS 6

1

Create a new profile.

Create a new profile from an existing default profile by copying the relevant directory. In the example we use the default profile as the base and call our new profile no-thp.

sudo cp -r /etc/tune-profiles/default /etc/tune-profiles/no-thp
2

Edit ktune.sh.

Edit /etc/tune-profiles/no-thp/ktune.sh and add the following:

set_transparent_hugepages never

to the start() block of the file, before the return 0 statement.

3

Enable the new profile.

Finally, enable the new profile by issuing:

sudo tuned-adm profile no-thp

Red Hat/CentOS 7

1

Create a new profile.

Create a new tuned profile directory:

sudo mkdir /etc/tuned/no-thp
2

Edit tuned.conf.

Create and edit /etc/tuned/no-thp/tuned.conf so that it contains the following:

[main]
include=virtual-guest

[vm]
transparent_hugepages=never
3

Enable the new profile.

Finally, enable the new profile by issuing:

sudo tuned-adm profile no-thp

Test Your Changes

You can check the status of THP support by issuing the following commands:

cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag

On Red Hat Enterprise Linux, CentOS, and potentially other Red Hat-based derivatives, you may instead need to use the following:

cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
cat /sys/kernel/mm/redhat_transparent_hugepage/defrag

For both files, the correct output resembles:

always madvise [never]




source - https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/








  • Install MongoDB > 
  • Install MongoDB on Red Hat Enterprise, CentOS, or Fedora Linux

Install MongoDB on Red Hat Enterprise, CentOS, or Fedora Linux

Synopsis

This tutorial outlines the basic installation process for deploying MongoDB on Red Hat Enterprise Linux, CentOS Linux, Fedora Linux and related systems. This procedure uses .rpm packages as the basis of the installation. 10gen publishes packages of the MongoDB releases as .rpm packages for easy installation and management for users of CentOS, Fedora and Red Hat Enterprise Linux systems. While some of these distributions include their own MongoDB packages, the 10gen packages are generally more up to date.

This tutorial includes: an overview of the available packages, instructions for configuring the package manager, the process install packages from the 10gen repository, and preliminary MongoDB configuration and operation.

Package Options

The 10gen repository contains two packages:

  • mongo-10gen-server

    This package contains the mongod and mongos daemons from the latest stable release and associated configuration and init scripts. Additionally, you can use this package to install daemons from a previous release of MongoDB.

  • mongo-10gen

    This package contains all MongoDB tools from the latest stable release. Additionally, you can use this package to install tools from a previous release of MongoDB. Install this package on all production MongoDB hosts and optionally on other systems from which you may need to administer MongoDB systems.

Install MongoDB

Configure Package Management System (YUM)

Create a /etc/yum.repos.d/10gen.repo file to hold information about your repository. If you are running a 64-bit system (recommended,) place the following configuration in /etc/yum.repos.d/10gen.repo file:

[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1

If you are running a 32-bit system, which isn’t recommended for production deployments, place the following configuration in/etc/yum.repos.d/10gen.repo file:

[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1

Install Packages

Issue the following command (as root or with sudo) to install the latest stable version of MongoDB and the associated tools:

yum install mongo-10gen mongo-10gen-server

When this command completes, you have successfully installed MongoDB!

Manage Installed Versions

You can use the mongo-10gen and mongo-10gen-server packages to install previous releases of MongoDB. To install a specific release, append the version number, as in the following example:

yum install mongo-10gen-2.2.3 mongo-10gen-server-2.2.3

This installs the mongo-10gen and mongo-10gen-server packages with the 2.2.3 release. You can specify any available version of MongoDB; however yum will upgrade the mongo-10gen and mongo-10gen-server packages when a newer version becomes available. Use the following pinning procedure to prevent unintended upgrades.

To pin a package, add the following line to your /etc/yum.conf file:

exclude=mongo-10gen,mongo-10gen-server

Configure MongoDB

These packages configure MongoDB using the /etc/mongod.conf file in conjunction with the control script. You can find the init script at/etc/rc.d/init.d/mongod.

This MongoDB instance will store its data files in the /var/lib/mongo and its log files in /var/log/mongo, and run using the mongod user account.

Note

 

If you change the user that runs the MongoDB process, you will need to modify the access control rights to the /var/lib/mongo and/var/log/mongo directories.

Control MongoDB

Warning

 

With the introduction of systemd in Fedora 15, the control scripts included in the packages available in the 10gen repository are not compatible with Fedora systems. A correction is forthcoming, see SERVER-7285 for more information, and in the mean time use your own control scripts or install using the procedure outlined in Install MongoDB on Linux.

Start MongoDB

Start the mongod process by issuing the following command (as root, or with sudo):

service mongod start

You can verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongo/mongod.log.

You may optionally, ensure that MongoDB will start following a system reboot, by issuing the following command (with root privileges:)

chkconfig mongod on

Stop MongoDB

Stop the mongod process by issuing the following command (as root, or with sudo):

service mongod stop

Restart MongoDB

You can restart the mongod process by issuing the following command (as root, or with sudo):

service mongod restart

Follow the state of this process by watching the output in the /var/log/mongo/mongod.log file to watch for errors or important messages from the server.

Control mongos

As of the current release, there are no control scripts for mongosmongos is only used in sharding deployments and typically do not run on the same systems where mongod runs. You can use the mongodb script referenced above to derive your own mongos control script.

SELinux Considerations

You must SELinux to allow MongoDB to start on Fedora systems. Administrators have two options:

  • enable access to the relevant ports (e.g. 27017) for SELinux. See Interfaces and Port Numbers for more information on MongoDB’s default ports.
  • disable SELinux entirely. This requires a system reboot and may have larger implications for your deployment.

Using MongoDB

Among the tools included in the mongo-10gen package, is the mongo shell. You can connect to your MongoDB instance by issuing the following command at the system prompt:

mongo

This will connect to the database running on the localhost interface by default. At the mongo prompt, issue the following two commands to insert a record in the “test” collection of the (default) “test” database and then retrieve that document.

> db.test.save( { a: 1 } )
> db.test.find()

See also

 

mongo” and “mongo Shell Methods


출처 - http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/



'DB > MongoDB' 카테고리의 다른 글

mongodb - BSON 사이즈 제한  (0) 2013.06.18
mongodb - GridFS save/read file 예제  (1) 2013.06.10
mongodb - connection pool  (0) 2013.05.26
mongodb - how to use  (0) 2013.05.21
mongodb - mongod.conf(web interface enable)  (0) 2013.05.19
Posted by linuxism
,