Raspberry Pi 3安装配置Raspbian过程(2)

来源:互联网 发布:马云大数据时代演讲 编辑:程序博客网 时间:2024/06/11 08:27

10. Samba服务器–共享文件

  • 移除已安装不兼容依赖包
    apt-get remove samba-common
    apt-get remove libwbclient0
  • 安装Samba
    apt-get install samba
    sudo smbpasswd -a ssyang #新增ssyang用户并设置密码
  • 配置文件(/etc/samba/smb.conf)
[global]        security = user #共享目录只能被授权的用户访问[Raspbian] #共享目录名        comment = Raspberry Pi Shared #对该共享的描述        path = /home/samba #共享目录路径        browseable = yes #可浏览        writable = yes #可写        available = yes #可用        guest ok = yes #允许guest账户访问        create mode = 0644 #新建文件权限        force create mode = 0644 #新建文件必须权限        directory mode = 0755 #新建目录权限        force directory mode = 0755 #新建目录必须权限

参数详解:Samba配置文件常用参数详解

11. Ftp服务器–vsftpd

apt-get install vsftpd #安装vsftpd
service vsftpd status #查看vsftpd服务状态

文件 含义 /etc/vsftpd.conf 主配置文件 /usr/sbin/vsftpd 主程序 /etc/pam.d/vsftpd PAM认证文件(此文件中file=/etc/ftpusers字段,指明阻止访问的用户来自/etc/ftpusers文件中的用户) /etc/ftpusers 禁止使用vsftpd的用户列表文件。记录不允许访问FTP服务器的用户名单 /etc/vsftpd.user_list 禁止或允许使用vsftpd的用户列表文件。缺省情况(即在/etc/vsftpd/vsftpd.conf中设置userlist_deny=YES)下也不能访问FTP服务器,在设置了userlist_deny=NO时,仅允许vsftpd.user_list中指定的用户访问FTP服务器 /var/ftp 匿名用户主目录 /home/用户主目录 本地用户主目录,即登录后进入自己家目录 /var/ftp/pub 匿名用户的下载目录,此目录需赋权根chmod 1777 pub(1为特殊权限,使上载后无法删除) /var/log/vsftpd.log 日志文件

限定用户不能跳出其主目录
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
allow_writeable_chroot=YES

Vsftpd本地用户不能登陆的解决方法
注释掉文件 /etc/pam.d/vsftpd中的此行:
auth required pam_shells.so
230 Login incorrect.问题解决。

12. Web服务器–Apache2


  • 安装
    apt-get install apache2 #安装apache2
  • 配置apache2
    service apache2 status #查看apache2服务状态
    netstat -ln | grep 80 #查看本机80端口状态
    netstat -anp | grep 80 #查看本机80端口状态及有关程序
    update-rc.d -f apache2 remove #从开机启动列表移除

附:ubuntu配置开机启动服务

13. 下载服务器–Aria2

  • 安装
    sudo apt-get install aria2
  • 配置文件
    touch aria2.conf #用于配置aria2
# 以后台程序运行daemon=true# 下载目录dir=/home/aria2/Downloads# 开启 rpc 模式enable-rpc=true# 允许所有来源rpc-allow-origin-all=true# 允许 rpc 模式下非外部访问rpc-listen-all=true# 读取下载进度文件input-file=/home/aria2/aria2.session# 保存下载进度文件save-session=/home/aria2/aria2.session# 自动保存下载进度时间间隔save-session-interval=60# 关闭文件预分配file-allocation=none# 断点续传continue=true# 单个任务最大线程数split=5# 最大同时下载任务数max-concurrent-downloads=3# 与服务器建立的最大连接数max-connection-per-server=5# 保存 BT 种子与磁力链接的元数据rpc-save-upload-metadata=true# 整体下载速度限制#max-overall-download-limit=0# 单个任务下载速度限制#max-download-limit=0# 整体上传速度限制#max-overall-upload-limit=0# 单个任务上传速度限制#max-upload-limit=0# 禁用IPv6disable-ipv6=true# 自动开始BT任务follow-torrent=true

touch /home/aria2/aria2.session #新建任务状态文件
mkdir /home/aria2/Downloads #新建下载目录

  • 启动aria2
    sudo aria2c –conf-path=/home/aria2/aria2.conf -D
    ps -ef | grep aria2 #查看进程列表中aria2进程
    netstat -ln | grep 6800 #查看本机6800端口状态

    设置aria2开机启动
    修改/etc/rc.local,添加一句aria2c –conf-path=/home/aria2/aria2.conf -D即可。

  • Aria Web客户端
    Aria Web客户端设置
    (可以将下载目录通过samba共享出来,这样局域网内电脑就能轻易获取下载的文件了)

14. 系统环境配置

login shell:代表用户登入,比如使用 su - 命令,或者用 ssh 连接服务器,都会使用该用户默认 shell 启动 login shell 模式。该模式下的 shell 会去自动执行 /etc/profile 和 ~/.profile 文件,但不会执行任何的 bashrc 文件,一般在 /etc/profile 或者 ~/.profile 去手动执行 bashrc 文件。
no-login shell:在终端下直接输入 bash 或者 bash -c CMD 来启动的 shell。该模式下是不会自动去运行任何的 profile 文件。
Shell详情:bashrc 和 profile
切换Shell:chsh命令

  • .bashrc(启用颜色显示并定义常用命令)
# enable color support of ls and also add handy aliasesif [ -x /usr/bin/dircolors ]; then    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"    alias ls='ls --color=auto'    alias dir='dir --color=auto'    alias vdir='vdir --color=auto'    alias grep='grep --color=auto'    alias fgrep='fgrep --color=auto'    alias egrep='egrep --color=auto'fi# colored GCC warnings and errors#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'# some more ls aliasesalias ll='ls -l'alias la='ls -A'alias l='ls -CF'
  • .profile(加载.bashrc文件)
# ~/.profile: executed by the command interpreter for login shells.# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login# exists.# see /usr/share/doc/bash/examples/startup-files for examples.# the files are located in the bash-doc package.# the default umask is set in /etc/profile; for setting the umask# for ssh logins, install and configure the libpam-umask package.#umask 022# if running bashif [ -n "$BASH_VERSION" ]; then    # include .bashrc if it exists    if [ -f "$HOME/.bashrc" ]; then        . "$HOME/.bashrc"    fifi# set PATH so it includes user's private bin if it existsif [ -d "$HOME/bin" ] ; then    PATH="$HOME/bin:$PATH"fi

15. Vim配置

配置文件(/etc/vim/vimrc

" The following are commented out as they cause vim to behave a lot" differently from regular Vi. They are highly recommended though.set showcmd             " Show (partial) command in status line."set showmatch          " Show matching brackets."set ignorecase         " Do case insensitive matching"set smartcase          " Do smart case matchingset incsearch           " Incremental search"set autowrite          " Automatically save before commands like :next and :make"set hidden             " Hide buffers when they are abandoned"set mouse=a            " Enable mouse usage (all modes)"colorscheme elflord "使用颜色主题elflordhighlight Comment ctermfg=magenta guifg=magenta "修改注释颜色set number "显示行号set tabstop=4set softtabstop=4set shiftwidth=4set ruler

16. putty窗口显示IP

配置文件(.profile)

export HISTTIMEFORMAT='%F %T 'export HOSTIP=`echo $SSH_CONNECTION | awk '{print $3}'`export PROMPT_COMMAND='echo -ne "\033]0;${USER}@$HOSTIP ${PWD/#$HOME/~} \007"'export PS1="\[\e[32m\]\u@\[\e[32m\]\h:\[\e[01;34m\]\w \$\[\e[00m\]"

putty显示效果如下:
putty显示效果
参考:linux下PS1命令提示符设置

17. Manpages

开发C代码需要安装的帮助页面:
apt-get install manpages #GNU/Linux 的基本操作
apt-get install manpages-dev #GNU/Linux 的基本操作API
apt-get install manpages-posix #POSIX 所定义公用程序的方法
apt-get install manpages-posix-dev #POSIX 的 header files 和 library calls

0 0