ubuntu 开发软件
OS
Ubuntu 16.04
ssh
安装ssh服务: sudo apt install openssh-server
上传公钥:
|
// 生成秘钥对 ssh-keygen -t rsa // 上传公钥 scp ~/.ssh/id_rsa.pub username@host:/home/username/.ssh // 公钥写入authorized_keys cat id_dsa.pub >> ~/.ssh/authorized_keys // 修改authorized_keys 权限为600 chmod 600 ~/.ssh/authorized_keys |
如果失败,修改如下配置:
/etc/ssh/sshd_config
|
RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys |
git
安装: sudo apt install git
配置文件: scp ~/.gitconfig username@host:/home/username
Shell
安装zsh: sudo apt install zsh
安装oh-my-zsh: sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
修改默认shell: chsh -s /bin/zsh
安装插件zsh-autosuggestions
:
|
// Clone 文件到 ~/.oh-my-zsh/custom/plugins/ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions // 修改~/.zshrc plugins=(zsh-autosuggestions) |
安装 tmux: sudo apt install tmux
vim
安装vim7.4: sudo apt install vim-nox
安装 spf13: curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh
Docker
安装Docker: sudo curl -fsSL https://get.docker.com/ | sh
加入docker 组 sudo usermod -aG docker xugang01_58
加入docker 组后或者root 权限下测试 docker run hello-world
php
安装CLI: sudo apt install php7.0-cli
安装插件:
多字节处理
sudo apt install php7.0-mbstring
mysql
sudo apt install php7.0-mysql
pear
|
sudo apt install php-pear sudo apt install php7.0-dev |
mongodb
|
pecl install mongodb sudo touch /etc/php/7.0/mods-available/mongodb.ini && echo extension=mongodb.so > /etc/php/7.0/mods-available/mongodb.ini sudo ln -s /etc/php/7.0/mods-available/mongodb.ini /etc/php/7.0/cli/conf.d/mongodb.ini |
redis
|
cd /tmp wget https://github.com/phpredis/phpredis/archive/php7.zip -O phpredis.zip unzip -o /tmp/phpredis.zip && mv /tmp/phpredis-* /tmp/phpredis && cd /tmp/phpredis && phpize && ./configure && make && sudo make install sudo touch /etc/php/7.0/mods-available/redis.ini && echo extension=redis.so > /etc/php/7.0/mods-available/redis.ini sudo ln -s /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/cli/conf.d/redis.ini |
JAVA
sudo apt install default-jre
MySQL
sudo apt install mysql-server-5.7
MongoDB
sudo apt install mongodb-server
|
sudo service mongod start sudo service mongod stop sudo service mongod restart |
FTP
sudo apt install vsftpd
|
// /etc/vsftpd.conf write_enable=YES // 设置可写权限 chroot_local_user=YES // terminal $ service vsftpd restart $ chmod a-w /home/user2/ // 登录用户目录不能可写 |
新建用户
|
// 为root设置密码 $sudo passwd root // 增加新用户(同名组, 根目录) $adduser username // 为用户添加sudo 权限 $sudo vim /etc/sudoers 'username ALL=(ALL)ALL' |
网络问题
设置固定IP
Ubuntu
/etc/network/interfaces
|
auto enp0s3 iface enp0s3 inet static address 192.168.1.114 gateway 192.168.1.1 netmask 255.255.255.0 newwork 192.168.0.0 broadcast 192.168.1.255 |
centos
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
/etc/sysconfig/network // 指定网管 GATEWAY=192.168.0.1 /etc/sysconfig/network-scripts/ifcfg-eth0 // 指定IP DEVICE="eth0" #BOOTPROTO="dhcp" BOOTPROTO="static" IPADDR=192.168.110.129 NETMASK=255.255.255.0 HWADDR="00:0C:29:53:A8:1D" IPV6INIT="no" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="f933b2bf-47eb-42f3-bea9-1f54088a2cb7" DNS1=192.168.110.2 /etc/resolv.conf // 指定DNS |
查看网关
重启网络
|
service networking restart /etc/init.d/network restart ifdown eth0 and ifup eth0 |
其他问题
1. phpredis for PHP 7
cext/standard/php_smart_str.h
不存在
原因: PHP7 php_smart_str.h 改名为 php_smart_string.h
解决: 下载最新的PhpRedis7.0 包
参考资料