附录*Ubuntu环境php开发配置

注意:Ubuntu安装完成后,没有网络,则需要安装驱动.

查看Ubuntu版本号:

方法1:

$ cat /etc/issue
Ubuntu 14.04.3 LTS \n \l

方法2(详细打印输出):

$ sudo lsb_release -a
[sudo] password for revin: 
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:    14.04
Codename:    trusty

更新Ubuntu

$ sudo apt-get upgrade
$ sudo apt-get update

安装git和vim:

$ sudo apt-get install git
$ sudo apt-get install vim

安装java 1.8 :

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

安装elasticsearch

  • 安装

$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.2.deb
$ sudo dpkg -i elasticsearch-1.5.2.deb
$ sudo vi /etc/elasticsearch/elasticsearch.yml
  • 配置

配置文件详解

$ sudo vi /etc/elasticsearch/elasticsearch.yml

# 注意34行,集群的名字,局域网不能重复,开发单机不用管
# cluster.name: elasticsearch-56

# 查看一下启用的配置:

$ grep '^[a-z]'  /etc/elasticsearch/elasticsearch.yml 

# 启动:

$ sudo service elasticsearch start

# 查看9200端口是否启用

$ sudo netstat -nlpt |grep 9200

# 插件安装

$  sudo /usr/share/elasticsearch/bin/plugin -i mobz/elasticsearch-head

#安装插件访问地址:http://localhost:9200/_plugin/head/

安装Rabbitmq

$ sudo apt-get install rabbitmq-server
$ cd /usr/lib/rabbitmq/bin/
$ ll
#开启ui插件
$ ./rabbitmq-plugins enable rabbitmq-management
$ cd ~
$ /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin/rabbitmq-plugins list
$ sudo /usr/lib/rabbitmq/lib/rabbitmq_server-3.2.4/sbin/rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart

创建快捷开发目录别名命令:

$ cd ~
$ vi .bashrc 
-----------------
alias zf='sudo -u www-data /usr/bin/php /var/www/public/index.php'
alias workc='cd /home/revin/work/code/'

$ source ~/.bashrc

配置logrotate:

linux下logrotate 配置和理解

比如apache,mysql等等日志进行设置

$ cd /etc/logrotate.d/
---------------------------------------
/var/www/data/log/* {
        size 100M
        missingok
        rotate 7
        compress
        create 664 www-data www-data
}

Last updated