最近在研究搭建manageIQ的开发环境,先粘贴官网上的搭建过程:
CentOS only - use yum instead of dnf.
Install Packages
sudo dnf -y group install "C Development Tools and Libraries" # For unf Gem and noi4r Gem
sudo dnf -y install git-all # Git and components
sudo dnf -y install memcached # Memcached for the session store
sudo dnf -y install postgresql-devel postgresql-server # PostgreSQL Database server and to build 'pg' Gem
sudo dnf -y install bzip2 libffi-devel readline-devel # For rbenv install 2.3.1 (might not be needed with other Ruby setups)
sudo dnf -y install libxml2-devel libxslt-devel patch # For Nokogiri Gem
sudo dnf -y install sqlite-devel # For sqlite3 Gem
sudo dnf -y install nodejs # For ExecJS Gem, bower, npm, yarn, webpack.. - needs at least 6.0.0
sudo dnf -y install libcurl-devel # For Curb
rpm -q --whatprovides npm || sudo dnf -y install npm # For CentOS 7, Fedora 23 and older
sudo dnf -y install openssl-devel # For rubygems
sudo dnf -y install cmake # For rugged Gem
sudo dnf -y install openscap # Optional, for openscap Gem for container SSA
Enable Memcached
sudo systemctl enable memcached
sudo systemctl start memcached
Configure PostgreSQL
sudo postgresql-setup initdb
sudo grep -q '^local\s' /var/lib/pgsql/data/pg_hba.conf || echo "local all all trust" | sudo tee -a /var/lib/pgsql/data/pg_hba.conf
sudo sed -i.bak 's/\(^local\s*\w*\s*\w*\s*\)\(peer$\)/\1trust/' /var/lib/pgsql/data/pg_hba.conf
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo -u postgres psql -c "CREATE ROLE root SUPERUSER LOGIN PASSWORD 'smartvm'"
# This command can return with a "could not change directory to" error, but you can ignore it
Install Packages
sudo apt install git # Git and components
sudo apt install memcached # Memcached for the session store
sudo apt install postgresql libpq-dev # PostgreSQL Database server and to build 'pg' Gem
sudo apt install bzip2 libffi-dev libreadline-dev # For rbenv install 2.3.1 (might not be needed with other Ruby setups)
sudo apt install libxml2-dev libxslt-dev patch # For Nokogiri Gem
sudo apt install libsqlite-dev libsqlite3-dev # For sqlite3 Gem
sudo apt install nodejs nodejs-legacy npm # For ExecJS Gem, bower, npm, yarn, webpack.. - needs at least 6.0.0
sudo apt install g++ # For unf Gem
sudo apt install libcurl4-gnutls-dev # For Curb
sudo apt install cmake # For rugged Gem
sudo apt install libgit2-dev pkg-config libtool
sudo apt install libssl-dev # for puma < 3.7.0
If your node version is less than 6.0 (debian currently has 4), you can either install it from the experimental
repo:
echo 'deb http://ftp.debian.org/debian/ experimental main non-free contrib' | sudo tee /etc/apt/sources.list.d/experimental.list
sudo apt update
sudo apt install nodejs nodejs-legacy npm
Alternatively, you can use nvm to install a node version locally (similar to rbenv
).
Ubuntu fix for failing Bundler
sudo apt remove libssl-dev
wget http://ftp.cz.debian.org/debian/pool/main/o/openssl1.0/libssl1.0-dev_1.0.2l-2_amd64.deb
wget http://ftp.cz.debian.org/debian/pool/main/o/openssl1.0/libssl1.0.2_1.0.2l-2_amd64.deb
sudo dpkg -i libssl1.0-dev_1.0.2l-2_amd64.deb libssl1.0.2_1.0.2l-2_amd64.deb
Enable Memcached
sudo systemctl enable memcached
sudo systemctl start memcached
Configure PostgreSQL
sudo grep -q '^local\s' /etc/postgresql/9.5/main/pg_hba.conf || echo "local all all trust" | sudo tee -a /etc/postgresql/9.5/main/pg_hba.conf
sudo sed -i.bak 's/\(^local\s*\w*\s*\w*\s*\)\(peer$\)/\1trust/' /etc/postgresql/9.5/main/pg_hba.conf
sudo systemctl restart postgresql
sudo su postgres -c "psql -c \"CREATE ROLE root SUPERUSER LOGIN PASSWORD 'smartvm'\""
Install Homebrew
If you do not have Homebrew installed, go to the Homebrew website and install it.
Install Packages
brew install git
brew install pkg-config
brew install memcached
brew install postgresql
brew install cmake
brew install node
brew install yarn
If your node version is less than 6, you may need to brew upgrade node
and brew link node
.
# Enable PostgreSQL on boot
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Create the ManageIQ superuser
psql -d postgres -c "CREATE ROLE root SUPERUSER LOGIN PASSWORD 'smartvm'"
Start memcached
# Enable Memcached on boot
ln -sfv /usr/local/opt/memcached/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
Git configuration and default settings.
git config --global user.name "Joe Smith"
git config --global user.email [email protected]
git config --global --bool pull.rebase true
git config --global push.default simple
If you need to use git with other email addresses, you can set the local user.email from within the clone using:
git config user.name "Joe Smith"
git config user.email [email protected]
git clone [email protected]:JoeSmith/manageiq.git # Use "-o my_fork" if you don't want the remote to be named origin
cd manageiq
git remote add upstream [email protected]:ManageIQ/manageiq.git
git fetch upstream
You can add other remotes at any time to collaborate with others by running:
git remote add other_user [email protected]:OtherUser/manageiq.git
git fetch other_user
Make sure your node version is at least 6.0.0. If not, you can use nvm to install a node version locally (similar to rbenv
).
Note: you may need to run the npm install -g
commands using sudo if you get permission errors, but if your node environment is up to date you should be able to install without sudo. If you do get these errors and you don’t want to use sudo, you can configure npm to install packages globally for a given user.
Install the Bower package manager
npm install -g bower
Install the Yarn package manager
Follow official instructions or
npm install -g yarn
Install the Gulp and Webpack build system
npm install -g gulp-cli
npm install -g webpack
bin/setup # Installs dependencies, config, prepares database, etc
bundle exec rake evm:start # Starts the ManageIQ EVM Application in the background
http://localhost:3000
. The default username is admin
with password smartvm
.bin/update # Updates dependencies using bundler and bower, runs migrations, prepares test db.
For provider, UI or other plugin development, see the guide on that topic.
Make sure you have memcached running. If not stop the server with bundle exec rake evm:stop
,start memcached and retry.
bin/setup fails
while trying to load the gem ‘sprockets/es6’If this happens check the log forExecJS::RuntimeUnavailable: Could not find a JavaScript runtime
a few lines down.When this message is present, then the you need to install node.js
and re-try
bin/setup
fails while trying to install the ‘nokogiri’ gemIf this happens, you may be missing developer tools in your OS X. Try to install them withxcode-select --install
and re-try.
bin/setup
fails to install the ‘sys-proctable’ gem, or installs the wrong version.If this happens it may be a Bundler issue. Try running bundle config specific_platform true
and re-try.
# install all dependencies to a local path
bundle install --path vendor/bundle
nokogiri-1.7.2
on a Mac# install dependencies
brew install pkgconfig
brew install libxml2
# test the gem can be compiled with the right libxml2
export PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig
gem install nokogiri -v 1.7.2 -- --use-system-libraries
# configure bundle to do so
bundle config build.nokogiri --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2
sys-proctable
on a Mac - a package missing even after bundle install succeededbundle config specific_platform true
bundle install
Install xcode developer tools
xcode-select --install
Uninstall existing ruby version with your version managerReinstall rubies with version manager