一聚教程网:一个值得你收藏的教程网站

热门教程

ubuntu安装php nginx mysql mongodb redis的教程

时间:2022-06-30 19:14:38 编辑:袖梨 来源:一聚教程网


ubuntu apt-get安装软件:

1、安装php:

apt-get install python-software-properties
apt-get install -y ppa-purge
add-apt-repository ppa:ondrej/php5
apt-get update
apt-get install php5-fpm php5-gd php5-cli php5-redis php5-mongo php5-curl php5-mysqlnd php5-bcmath php5-mcrypt php5-dev

2、安装nginx:


add-apt-repository ppa:nginx/stable
apt-get update
apt-get install nginx

3、安装mysql:


add-apt-repository 'deb http://ppa.launchpad.net/ondrej/mysql-5.6/ubuntu precise main'
apt-get install mysql-server-5.6
mysql_install_db --user=mysql --basedir=/usr --datadir=/data/mysql/var/
service mysql start

如果在安装过程中,遇到如下错误:

ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)

解决办法:

mysql -uroot -p
执行:GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'your password';

并修改/etc/mysql/debian.cnf 内容如下:


[client]
host     = localhost
user     = debian-sys-maint
password =
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password =
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

4、安装redis:


add-apt-repository -y ppa:rwky/redis
apt-get update
apt-get install redis

5、mongodb安装:

 

echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
apt-get update
apt-get install -y mongodb-org
6、解决shell脚本运行报错:


 Syntax error: "(" unexpected

解决办法:


dpkg-reconfigure dash
 

热门栏目