您正在查看: linux 分类下的文章

使用Start SSL免费申请SSL证书,并为nginx server添加SSL支持

start ssl证书申请

  • 首先在start ssl网站注册一个账号
  • 登录后进入登录页面,点击Validations Wizard,并选择Domain Validation,添加一个新的域名

add_domain.png

  • 点击Certificates Wizard,选择申请Web Server SSL,一直按照向导,进入到填写信息的页面。

Continue Reading...

bash snippets

Little Useful Functions

The Real Dir of Script itsef

sometimes we need to change dir to the real path of a script and do something. But this little thing is very hard to make it works in lots of Linux Distribution and Mac OS X. The snippets below is work on CentOS, Ubuntu and Mac OS X 10.10.

#!/bin/sh
# read link 
_script="$(readlink -n ${0})"
if [[ $_script = '' ]]; then
    # when call script without symbolic, readlink will return empty string
    pushd `dirname $0` > /dev/null
    _script=`pwd`
    popd > /dev/null
else
    _script="$(dirname $_script)"
fi
echo 'the real path is ' $_script

command usage

echo color

16color syntax:

# \033 is the Escape symbol in ASCII, it can also written in \x1b
echo -e "\033[${attr};${clbg};${clfg}m${renderText}\033[0m"
# -e explain as use string escape
# if you let \033[ in a variable, -e is not necessary. such as
start="\x1b["
end="\x1b[0m"
echo "${start}${attr};${clbg};${clfg}m${renderText}${end}"

which attr is control number, clbg is background color, clfg is foreground color.
The detail is in tip_colors_and_formatting

Dell R730服务器在Ubuntu 14.04 LTS中安装网卡驱动

前言

今天被分配到一个任务,就是去给一台新的服务器安装系统。用U盘做了个启动盘,居然半天没能启动。 只能自己做一个DVD盘。 结果安装好了之后,准备配置IP的时候,发现没有网卡驱动。只能手动安装了。。。
查询清单得知网卡型号是broadcom的5700系列的。因此去官网下载了驱动。 下载下来之后发现,是源码。。。。
考虑到服务器中没有make等一系列构建工具。找了一台普通的X86的64位Ubuntu14.04的桌面版进行编译,得到了ko格式的内核模块。

Continue Reading...

Ubuntu ssh登录时,出现 warning: Setting locale failed 的正确解决方法

本文转载自 perl: warning: Setting locale failed.引发的问题

缘由

我用的是linode的vps,系统为ubuntu14.04LTS
当apt-get安装软件时,都会报一个相同的错误,如下

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "zh_CN.UTF-8",
    LC_MONETARY = "zh_CN.UTF-8",
    LC_ADDRESS = "zh_CN.UTF-8",
    LC_TELEPHONE = "zh_CN.UTF-8",
    LC_NAME = "zh_CN.UTF-8",
    LC_MEASUREMENT = "zh_CN.UTF-8",
    LC_IDENTIFICATION = "zh_CN.UTF-8",
    LC_NUMERIC = "zh_CN.UTF-8",
    LC_PAPER = "zh_CN.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Continue Reading...