Build a MEAN development environment in Ubuntu 15.10

Source: Internet
Author: User
Tags install mongodb

Build a MEAN development environment in Ubuntu 15.10

This article describes how to build a MEAN development environment on Ubuntu 15.10.

1. Install Node. js and use nvm to install npm
Nvm is a simple Bash script that can be used to install and maintain different Node. js versions on the same host. Run the following command:

# Wget-QoS-https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
This script will clone the nvm repository ~ /. Nvm, and configure environment variables (IN ~ /. Bash_profile file or ~ /. Zshrc file or ~ /. Profile configuration)

To download, compile, and install the latest Node. js, run the following command:

# Nvm install 4.2.2
Now, you can determine to use this version of Node. js and execute the command:

# Nvm use 4.2.2
With nvm, you can also install other versions of Node. js, such as the latest unstable version or older version, you only need to use the nvm command and specify Node. install the js version.

For Node. js development, you also need the npm Package Manager and MEAN full stack development. Node. js has built-in npm, so you do not need to install npm separately. If you want to use the latest npm version, you can:

# Npm install-g npm
The above command will install the latest version of npm. All the steps for setting up the Node. js environment are described above.

2. Install MongoDB
First, you need to import the Public Key GPG of MongoDB and run the following command:

# Sudo apt-key adv -- keyserver hkp: // keyserver.ubuntu.com: 80 -- recv 7F0CEB10
Then, you can obtain the MongoDB software from the Debian wheezy software warehouse and run the following command:

# Echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee/etc/apt/sources. list. d/mongodb-org-3.0.list
Next, upgrade the local software package:

# Sudo apt-get update
Finally, run the following command to install the latest stable version of MongoDB:

# Sudo apt-get install-y mongodb-org
In this case, you can use the sudo service mongodb start command to start the MongoDB service. If an error is prompted, run the following command to fix the problem:

Create the/data/db directory and open the MongoDB configuration file:

# Sudo mkdir-p/data/db
# Sudo gedi
Change dbpath =/var/lib/mongodb to dbpath =/data/db and save the file.

# Sudo chown-R mongodb: mongodb/data/db
Now, you can start the MongoDB service again.

# Sudo service producer D start
To check the status of the MongoDB service, run the following command:

# Sudo systemctl status mongod
The above steps are enough to build the MongoDB environment. Next, we will start to build the MEAN environment.

3. Install MEAN
First, you need to install Bower. Bower is a package manager that manages various front-end library packages, such as Angular. js, BootStrap, and jQuery libraries. Run the following command to install Bower:

# Npm install-g bower
Next, you also need to install Grunt, which is a task runner that can automate the deployment process. Run the following command:

# Npm install-g grunt-cli
This will install the grunt command line tool globally.

To download the MEAN, you can clone it from the Git source code repository to the project directory:

# Git clone https://github.com/meanjs/mean.git meanjs
Open the mean folder and run the following command in its parent directory:

# Npm install
This will install all dependencies required by the project, which are defined in the package. json configuration file.

Finally, run grunt:

# Grunt
This will automatically open a new page and display the MEAN. JS welcome page:

Note:
* After grunt is run, an error page may appear, prompting "couldn't start MongoDB on default port 27017." (that is, the system prompts that the default port 27017 of MongoDB cannot be accessed ). In this case, you must use the Administrator permission to open port 27017.
* MEAN full stack development is great. Now we can start.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.