In Ubuntu 15.10 to build the mean development environment Chszs, not allowed to reprint without the Bo master. Permission to reprint should be marked by the author and blog home: Http://blog.csdn.net/chszs
This article focuses on how to build mean development environment on Ubuntu 15.10 System.
1. Install node. js and install NPM with NVM
NVM is a simple bash script that can be used to install and maintain different versions of node. JS on the same host. Execute command:
# wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
This script clones the NVM repository to ~/.NVM and configures the environment variables (configured in the ~/.bash_profile file or ~/.ZSHRC file or ~/.profile)
To download, compile, and install the latest node. js, you can simply execute the command:
# nvm install 4.2.2
Now, be sure to use this version of node. js to execute the command:
# nvm use 4.2.2
With NVM, you can also install other versions of node. js, such as the latest non-stable version, or the older version, just use the NVM command and specify the node. js version to install.
For the development of node. JS, the NPM Package Manager is also required, which is also required for mean full stack development. node. JS has a built-in NPM, so you don't need to install NPM separately. If you want to use the latest version of NPM, you can:
# npm install -g npm
The above command installs the latest version of NPM. All steps to build a node. JS environment are described above.
2. Installing MongoDB
First, you need to import MongoDB's public key GPG, using the command:
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
MongoDB software can then be obtained from the Debian Wheezy software repository using the 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 package:
# sudo apt-get update
Finally, use the command to install the latest, stable version of MongoDB:
# sudo apt-get install -y mongodb-org
At this point, you can start the MongoDB service by using the sudo service mongodb start command. If the prompt fails, you can use the following command to fix it:
Create the/data/db directory and open the MongoDB configuration file:
# sudo mkdir -p /data/db# sudo gedi
Modify the content 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 mongod start
To check the status of the MongoDB service, use the command:
# sudo systemctl status mongod
Building a MongoDB environment using the steps above is enough, then start building the mean environment.
3, installation mean
First, you need to install bower. Bower is a package manager that can manage various library packages at the front end, such as Angular.js, BootStrap, and jquery libraries. Install bower using the following command:
# npm install -g bower
Next, you need to install Grunt,grunt is a task runner that automates the deployment process. Execute command:
# npm install -g grunt-cli
This will install the Grunt command-line tool globally.
To download mean, you can clone it from the Git repository to the project directory:
# git clone https://github.com/meanjs/mean.git meanjs
Now, open the mean folder and execute the command under its parent directory:
# npm install
This installs all the dependencies required for the project, which are defined in the Package.json configuration file.
Finally, run Grunt:
# grunt
This will automatically open a new page that displays the Mean.js Welcome page:
Attention:
* After running grunt, the error page may appear, prompting "couldn ' t start MongoDB on default port 27017." (That is, you are not prompted to access the default 27017 port of MongoDB.) At this point, you need to open port 27017 with administrator privileges.
* Mean full stack development is great and can now be started.
Build mean development environment in Ubuntu 15.10