Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-05-21 12:42:10 +08:00
commit 48efa35d2f
9 changed files with 594 additions and 678 deletions

View File

@ -0,0 +1,82 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12235-1.html)
[#]: subject: (Customizing my open source PHP framework for web development)
[#]: via: (https://opensource.com/article/20/5/codeigniter)
[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14)
自定义用于 Web 开发的开源 PHP 框架 Codeigniter
======
> Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。
![](https://img.linux.net.cn/data/attachment/album/202005/21/102637vslj5zqk52x98a52.jpg)
PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对冷清的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。
我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务并不算常见,没有可以作为模板的默认功能集或现有后台管理系统,所以我需要一个能提供良好的、可靠的、可以建立在此基础上的原始材料。最初,我考虑用其他平台(如 Wordpress用于我们的网站。但是我决定使用 Codeigniter因为它的灵活性以及集成了在我们的补课匹配过程中需要的功能。
以下是打动我使用 Codeigniter 的原因:
* 与 MySQL 数据库的集成 —— 主要功能是允许客户端浏览导师的数据库并添加导师,例如类似于电子商务平台的“购物车”。
* 客户端界面系统 —— 用户可以登录来管理偏好并编辑详细信息,修改所教的科目、旅游的地区、手机号码、地址等。
* 定制的管理员面板 —— 管理员可以使用定制的管理面板访问客户提交的资料,它与客户服务功能集成在一起,因此管理员可以单独跟进。
* 付款系统 —— 管理面板带有与 Paypal 集成的发票和付款网关。
* CMS 编辑器界面 —— 管理员能够编辑博客和文章中的文本和图像,以及添加新页面。
该项目花费了大约六个月的时间来完成,另外花了两个月的调试时间。如果我需要从头开始构建所有,或者尝试重新设计现有的框架以满足我们的需求,那将花费更长的时间,而且可能最终无法满足客户需求。
### 功能和优点
PHP Codeigniter还有很多吸引开发者的功能包括错误处理和代码格式化这些功能在各种编码情景下都非常有用。它支持模板可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。
Codeigniter 的主要功能是:
* XML 核心服务,
* HTTP/FTP 核心服务
* AppData 和 PHP 沙箱功能
* XSLT 和 HTML 模板
* 加密的信息传输
* PCM Codeigniter 服务器监控
* 应用集成
* 文件传输协议FTP
* 服务台支持
* Apache POI用于托管网站的内容管理基础架构
#### 兼容性
Codeigniter 与许多领先的软件程序兼容,例如 PHP、MySQL、[MariaDB][3]、[phpMyAdmin][4]、[Apache][5]、OpenBSD、XSLT、[SQLite][6] 等。许多公司更喜欢使用 Codeigniter 产品来满足网站要求,因为它们易于使用和集成。如果你不想创建自己的网站,你可以找到许多提供自定义 Web 开发服务的开发人员和设计机构。
#### 安全
Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。
#### 其它功能
一家优秀的 PHP Web 开发公司会使用几种高级技术和第三方技术,例如 XML 和 PHP。它为企业提供了一个完整的平台可以开发出具有看起来专业的、好用的商业网站。Codeigniter 使得第三方技术的使用变得容易,并可以与常见的 Web 开发软件一起使用。这使得 Web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。
### 使用 PHP 框架 Codeigniter
Codeigniter 给企业提供了完整的 PHP 开发包,它将提供强大的功能、灵活性和性能完美结合在一起。到目前为止,我很满意我们的网站,并不断地升级和添加新的功能。并不断升级和增加新的功能。我期待着发现我们的网站还能用 Codeigniter 做些什么。你也是这样么?
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/5/codeigniter
作者:[Wee Ben Sen][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/bswee14
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
[2]: https://codeigniter.com/
[3]: http://mariadb.org/
[4]: https://www.phpmyadmin.net/
[5]: http://apache.org/
[6]: http://sqlite.org/

View File

@ -1,137 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to create a personal file server with SSH on Linux)
[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
How to create a personal file server with SSH on Linux
======
Connecting to a remote Linux system over SSH is just plain easy. Here's
how to do it.
![Hand putting a Linux file folder into a drawer][1]
The Raspberry Pi makes for a useful and inexpensive home server for lots of things. I most often use the [Raspberry Pi as a print server][2] to share a laser printer with other devices in our home or as a personal file server to store copies of projects and other data.
I use this file server in various ways. Let's say I'm working on a project, such as a new book, and I want to make a snapshot copy of my work and all my associated files. In that case, I simply copy my **BookProject** folder to a **BookBackup** folder on the file server.
Or if I'm cleaning up my local files, and I discover some files that I don't really need but I'm not yet ready to delete, I'll copy them to a **KeepForLater** folder on the file server. That's a convenient way to remove clutter from my everyday Linux system and offload infrequently used files to my personal file server.
Setting up a Raspberry Pi—or any Linux system—as a personal file server doesn't require configuring Network File System (NFS) or Common Internet File System (CIFS) or tinkering with other file-sharing systems such as WebDAV. You can easily set up a remote file server using SSH. And here's how.
### Set up SSHD on the remote system
Your Linux system probably has the SSH daemon (sshd) installed. It may even be running by default. If not, you can easily set up SSH through whatever control panel you prefer on your Linux distribution. I run [Fedora ARM][3] on my Raspberry Pi, and I can access the control panel remotely by pointing my Pi's web browser to port 9090. (On my home network, the Raspberry Pi's IP address is **10.0.0.11**, so I connect to **10.0.0.11:9090**.) If the SSH daemon isn't running by default, you can set it to start automatically in Services in the control panel.
![sshd in the list of system services][4]
You can find sshd in the list of system services.
![slider to activate sshd][5]
Click the slider to activate **sshd** if it isn't already.
### Do you have an account?
Make sure you have an account on the remote system. It might be the same as the username you use on your local system, or it could be something different.
On the popular Raspbian distribution, the default account username is **pi**. But other Linux distributions may require you to set up a unique new user when you install it. If you don't know your username, you can use your distribution's control panel to create one. On my Raspberry Pi, I set up a **jhall** account that matches the username on my everyday Linux desktop machine.
![Set up a new account on Fedora Server][6]
If you use Fedora Server, click the **Create New Account** button to set up a new account.
![Set password or SSH key][7]
Don't forget to set a password or add a public SSH key.
### Optional: Share your SSH public key
If you exchange your public SSH key with the remote Linux system, you can log in without having to enter a password. This step is optional; you can use a password if you prefer.
You can learn more about SSH keys in these Opensource.com articles:
* [Tools for SSH key management][8]
* [Graphically manage SSH keys with Seahorse][9]
* [How to manage multiple SSH keys][10]
* [How to enable SSH access using a GPG key for authentication][11]
### Make a file manager shortcut
Since you've started the SSH daemon on the remote system and set up your account username and password, all that's left is to map a shortcut to the other Linux system from your file manager. I use GNOME as my desktop, but the steps are basically the same for any Linux desktop.
#### Make the initial connection
In the GNOME file manager, look for the **+Other Locations** button in the left-hand navigation. Click that to open a **Connect to Server** prompt. Enter the address of the remote Linux server here, starting with the SSH connection protocol.
![Creating a shortcut in GNOME file manager][12]
The GNOME file manager supports a variety of connection protocols. To make a connection over SSH, start your server address with **sftp://** or **ssh://**.
If your username is the same on your local Linux system and your remote Linux system, you can just enter the server's address and the folder location. To make my connection to the **/home/jhall** directory on my Raspberry Pi, I use:
```
`sftp://10.0.0.11/home/jhall`
```
![GNOME file manager Connect to Server][13]
If your username is different, you can specify your remote system's username with an **@** sign before the remote system's address. To connect to a Raspbian system on the other end, you might use:
```
`sftp://pi@10.0.0.11/home/pi`
```
![GNOME file manager Connect to Server][14]
If you didn't share your public SSH key, you may need to enter a password. Otherwise, the GNOME file manager should automatically open the folder on the remote system and let you navigate.
![GNOME file manager connection][15]
#### Create a shortcut so you can easily connect to the server later
This is easy in the GNOME file manager. Right-click on the remote system's name in the navigation list, and select **Add Bookmark**. This creates a shortcut to the remote location.
![GNOME file manager - adding bookmark][16]
If you want to give the bookmark a more memorable name, you can right-click on the shortcut and choose **Rename**.
### That's it!
Connecting to a remote Linux system over SSH is just plain easy. And you can use the same method to connect to systems other than home file servers. I also have a shortcut that allows me to instantly access files on my provider's web server and another that lets me open a folder on my project server. SSH makes it a secure connection; all of my traffic is encrypted. Once I've opened the remote system over SSH, I can use the GNOME file manager to manage my remote files as easily as I'd manage my local folders.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/3/personal-file-server-ssh
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://opensource.com/article/18/3/print-server-raspberry-pi
[3]: https://arm.fedoraproject.org/
[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services)
[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd)
[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server)
[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key)
[8]: https://opensource.com/article/20/2/ssh-tools
[9]: https://opensource.com/article/19/4/ssh-keys-seahorse
[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage
[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh
[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager)
[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server)
[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server)
[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection)
[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark)

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,146 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Tricks for getting around your Linux file system)
[#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
Tricks for getting around your Linux file system
======
The cd command is probably one of the first 10 that any Linux user learns, but it's not the only way to navigate the Linux file system.Here are some other ways.
Thinkstock
Whether you're moving around the file system, looking for files or trying to move into important directories, Linux can provide a lot of help. In this post, we'll look at a number of tricks to make moving around the file system and both finding and using commands that you need a little easier.
### Adding to your $PATH
One of the easiest and most useful ways to ensure that you don't have to invest a lot of time into finding commands on a Linux system is to add the proper directories to your $PATH variable. The order of directories that you add to your $PATH variable is, however, very important. They determine the order in which the system will look through the directories to find the command to run -- stopping when it finds the first match.
You might, for example, want to put your home directory first so that, if you create a script that has the same name as some other executable, it will be the one that you end up running whenever you type its name.
[RELATED: Linux hardening: a 15-step checklist for a secure Linux server][1]
To add your home directory to your $PATH variable, you could do this:
```
$ export PATH=~:$PATH
```
The **~** character represents your home directory.
If you keep your scripts in your bin directory, this would work for you:
```
$ export PATH=~/bin:$PATH
```
You can then run a script located in your home directory like this:
[][2]
```
$ myscript
Good morning, you just ran /home/myacct/bin/myscript
```
**IMPORTANT:** The commands shown above _add_ to your search path because $PATH (the current path) is included. They don't override it. Your search path should be configured in your **.bashrc** file, and any changes you intend to be permanent should be added there as well.
### Using symbolic links
Symbolic links provide an easy and obvious way to record the location of directories that you might need to use often. If you manage content for a web site, for example, you might want to get your account to "remember" where the web files are located by creating a link like this:
```
ln -s /var/www/html www
```
The order of the arguments is critical. The first (/var/www/html) is the target and the second is the name of the link that you will be creating. If you're not currently located in your home directory, the following command would do the same thing:
```
ln -s /var/www/html ~/www
```
After setting this up, you can use "cd www" to get to **/var/www/html**.
### Using shopt
The **shopt** command also provides a way to make moving to a different directory a bit easier. When you employ **shopt'**s **autocd** option, you can go to a directory simply by typing its name. For example:
```
$ shopt -s autocd
$ www
cd -- www
/home/myacct/www
$ pwd -P
/var/www/html
$ ~/bin
cd -- /home/myacct/bin
$ pwd
/home/myacct/bin
```
In the first set of commands above, the **shopt** command's **autocd** option is enabled. Typing **www** then invokes a "cd www" command. Because this symbolic link was created in one of the **ln** command examples above, this moves us to **/var/www/html**. The **pwd -P** command displays the actual location.
In the second set, typing **~/bin** invokes a **cd** into the **bin** directory in the user's home.
Note that the **autocd** behavior will _not_ kick in when what you type is a command   even if it's also the name of a directory.
The **shopt** command is a bash builtin and has a lot of options. This one just means that you don't have to type "cd" before the name of each directory you want to move into.
To see **shopt**'s other options, just type "shopt".
### Using $CDPATH
Probably one of the most useful tricks for moving into particular directories is adding the paths that you want to be able to move into easily to your **$CDPATH**. This creates a list of directories that will be moved into by typing only a portion of the full path names.
There is one aspect of this that may be just a little tricky. Your **$CDPATH** needs to include the directories that _contain_ the directories that you want to move into, not the directories themselves.
For example, say that you want to be able to move into the **/var/www/html** directory simply by typing "cd html" and into subdirectories in /var/log using only "cd" and the simple directory names. In this case, this **$CDPATH** would work:
```
$ CDPATH=.:/var/log:/var/www
```
Here's what you would see:
```
$ cd journal
/var/log/journal
$ cd html
/var/www/html
```
Your **$CDPATH** kicks in when what you type is _not_ a full path. Then it looks down its list of directories in order to see if the directory you identified exists in one of them. Once it finds a match, it takes you there.
Keeping the "." at the beginning of your **$CDPATH** means that you can move into local directories without having to have them defined in the **$CDPATH**.
```
$ export CDPATH=".:$CDPATH"
$ Videos
cd -- Videos
/home/myacct/Videos
```
It's not hard to move around the Linux file system, but you can save a few brain cells if you use some handy tricks for getting to various locations easily.
Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/article/3143050/linux/linux-hardening-a-15-step-checklist-for-a-secure-linux-server.html#tk.nww-fsb
[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy)
[3]: https://www.facebook.com/NetworkWorld/
[4]: https://www.linkedin.com/company/network-world

View File

@ -1,311 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Speed up administration of Kubernetes clusters with k9s)
[#]: via: (https://opensource.com/article/20/5/kubernetes-administration)
[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb)
Speed up administration of Kubernetes clusters with k9s
======
Check out this cool terminal UI for Kubernetes administration.
![Dogs playing chess][1]
Usually, my articles about Kubernetes administration are full of kubectl commands for administration for your clusters. Recently, however, someone pointed me to the [k9s][2] project for a fast way to review and resolve day-to-day issues in Kubernetes. It's been a huge improvement to my workflow and I'll show you how to get started in this tutorial. 
Installation can be done on a Mac, in Windows, and Linux. Instructions for each operating system can be found [here][2]. Be sure to complete installation to be able to follow along.
I will be using Linux and Minikube, which is a lightweight way to run Kubernetes on a personal computer. Install it following [this tutorial][3] or by using the [documentation][4].
### Setting the k9s configuration file
Once you've installed the k9s app, it's always good to start with the help command.
```
$ k9s help
K9s is a CLI to view and manage your Kubernetes clusters.
Usage:
  k9s [flags]
  k9s [command]
Available Commands:
  help        Help about any command
  info        Print configuration info
  version     Print version/build info
Flags:
  -A, --all-namespaces                 Launch K9s in all namespaces
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
  -c, --command string                 Specify the default command to view when the application launches
      --context string                 The name of the kubeconfig context to use
      --demo                           Enable demo mode to show keyboard commands
      --headless                       Turn K9s header off
  -h, --help                           help for k9s
      --insecure-skip-tls-verify       If true, the server's caCertFile will not be checked for validity
      --kubeconfig string              Path to the kubeconfig file to use for CLI requests
  -l, --logLevel string                Specify a log level (info, warn, debug, error, fatal, panic, trace) (default "info")
  -n, --namespace string               If present, the namespace scope for this CLI request
      --readonly                       Disable all commands that modify the cluster
  -r, --refresh int                    Specify the default refresh rate as an integer (sec) (default 2)
      --request-timeout string         The length of time to wait before giving up on a single server request
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
Use "k9s [command] --help" for more information about a command.
```
As you can see, there is a lot of functionality we can configure with k9s. The only step we need to take place to get off the ground is to write a configuration file. The **info** command will point us to where the application is looking for it.
```
$ k9s info
 ____  __.________
|    |/ _/   __   \\______
|      < \\____    /  ___/
|    |  \   /    /\\___ \
|____|__ \ /____//____  >
        \/            \/
Configuration:   /Users/jess/.k9s/config.yml
Logs:            /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log
Screen Dumps:    /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess
```
 By default, k9s expects a configuration file and will fail to run without one. The command will return without any message, but if we look at the log file we see an error.
```
$ tail -1 /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-mbbroberg.log
10:56AM FTL Unable to connect to api server error="Missing or incomplete configuration info.  Please point to an existing, complete config file:\n\n  1. Via the command-line flag --kubeconfig\n  2. Via the KUBECONFIG environment variable\n  3. In your home directory as ~/.kube/config\n\nTo view or setup config directly use the 'config' command."
```
To add a file, make the directory if it doesn't already exist and then add one.
```
$ mkdir -p ~/.k9s/
$ touch ~/.k9s/config.yml
```
For this introduction, we will use the default config.yml recommendations from the k9s repository. The maintainers note that this format is subject to change, so we can [check here][5] for the latest version.
```
k9s:
  refreshRate: 2
  headless: false
  readOnly: false
  noIcons: false
  logger:
    tail: 200
    buffer: 500
    sinceSeconds: 300
    fullScreenLogs: false
    textWrap: false
    showTime: false
  currentContext: minikube
  currentCluster: minikube
  clusters:
    minikube:
      namespace:
        active: ""
        favorites:
       - all
        - kube-system
        - default
      view:
        active: dp
  thresholds:
    cpu:
      critical: 90
      warn: 70
    memory:
      critical: 90
      warn: 70
```
We set k9s to look for a local minikube configuration, so I'm going to confirm minikube is online and ready to go. 
```
$ minikube status
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
```
### Running k9s to explore a Kubernetes cluster
### With a configuration file set and pointing at our local cluster, we can now run the **k9s** command.
```
`$ k9s`
```
Once you start it up, the k9s text-based user interface (UI) will pop up. With no flag for a namespace, it will show you the pods in the default namespace.
![K9s screenshot][6]
If you run in an environment with a lot of pods, the default view can be overwhelming. Alternatively, we can focus on a given namespace. Exit the application and run **k9s -n <namespace>** where _<namespace>_ is an existing namespace. In the picture below, I ran **k9s -n minecraft,** and it shows my broken pod
![K9s screenshot][7]
So once you have k9s up and running, there are a bunch of things you can do quickly. 
Navigating k9s happens through shortcut keys. We can always use arrow keys and the enter key to choose items listed. There are quite a few other universal keystrokes to navigate to different views:
* **0**—Show all pods in all namespaces
![K9s screenshot][8]
* **d**—Describe the selected pod
![K9s screenshot][9]
* **l**—Show logs for the selected pod pod
![Using k9s to show Kubernetes pod logs][10]
You may notice that k9s is set to use [Vim command keys][11], including moving up and down using **J** and **K** keys. Good luck exiting, emacs users :)
### Viewing different Kubernetes resources quickly
Need to get to something that's not a pod? Yea I do too. There are a number of shortcuts that are available when we enter a colon (":") key. From there, you can use the following commands to navigate around there.
* **:svc**—Jump to a services view.
![K9s screenshot][12]
* **:deploy**—Jump to a deployment view.
![K9s screenshot][13]
* **:rb**—Jump to a Rolebindings view for [role-based access control (RBAC)][14] management.
![K9s screenshot][15]
* **:namespace**—Jump back to the namespaces view.
![K9s screenshot][16]
* **:cj**—Jump to the cronjobs view to see what jobs are scheduled in the cluster.
![K9s screenshot][17]
The most used tool for this application will be the keyboard; to go up or down on any page, use the arrow keys. If you need to quit, remember to use Vim keybindings. Type **:q** and hit enter to leave.
### Example of troubleshooting Kubernetes with k9s
How does k9s help when something goes wrong? To walk through an example, I let several pods die due to misconfiguration. Below you can see my terrible hello deployment that's crashing. Once we highlight it, we press **d** to run a _describe_ command to see what is causing the failure.
![K9s screenshot][18]
![K9s screenshot][19]
Skimming the events does not tell us a reason for the failure. Next, I hit the **esc** key and go check the logs by highlighting the pod and entering **<shift-l>**.
![K9s screenshot][20]
Unfortunately, the logs don't offer anything helpful either (probably because the deployment was never correctly configured), and the pod will not come up.
I then **esc** to step back out, and I will see if deleting the pod will take care of this issue. To do so, I highlight the pod and use **<ctrl-d>**. Thankfully, k9s prompts users before deletion. 
![K9s screenshot][21]
While I did delete the pod, the deployment resource still exists, so a new pod will come back up. It will also continue to restart and crash for whatever reason (we don't know yet).
Here is the point where I would repeat reviewing logs, describing resources, and use the **e** shortcut to even edit a running pod to troubleshoot the behavior. In this particular case, the failing pod is not configured to run in this environment. So let's delete the deployment to stop crash-then-reboot loop we are in.
We can get to deployments by typing **:deploy** and clicking enter. From there we highlight and press **<ctrl-d>** to delete.
![K9s screenshot][22]
![K9s screenshot][23]
And poof the deployment is gone! It only took a few keystrokes to clean up this failed deployment.
### k9s is incredibly customizable
So this application has a ton of customization options, down to the color scheme of the UI. Here are a few editable options you may be interested in:
* Adjust where you put the config.yml file (so you can store it in [version control][24])
* Add [custom aliases][25] to an **alias.yml** file
* Create [custom hotkeys][26] in a **hotkey.yml** file
* Explore available [plugins][27] or write your own
The entire application is configured in YAML files, so customization will feel familiar to any Kubernetes administrator.
### Simplify your life with k9s
I'm prone to administrating over my team's systems in a very manual way, more for brain training than anything else. When I first heard about k9s, I thought, "This is just lazy Kubernetes," so I dismissed it and went back to doing my manual intervention everywhere. I actually started using it daily while working through my backlog, and I was blown away at how much faster it was to use than kubectl alone. Now I'm a convert. 
It's important to know your tools and master the "hard way" of doing something. It is also important to remember, as far as administration goes, it's important to work smarter, not harder. Using k9s is the way I live up to that objective. I guess we can call it lazy Kubernetes administration, and that's okay.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/5/kubernetes-administration
作者:[Jessica Cherry][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/cherrybomb
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess)
[2]: https://github.com/derailed/k9s
[3]: https://opensource.com/article/18/10/getting-started-minikube
[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/
[5]: https://github.com/derailed/k9s#k9s-configuration
[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot)
[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot)
[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot)
[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot)
[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs)
[11]: https://opensource.com/article/19/3/getting-started-vim
[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot)
[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot)
[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot)
[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot)
[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot)
[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot)
[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot)
[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot)
[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot)
[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot)
[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot)
[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control
[25]: https://k9scli.io/topics/aliases/
[26]: https://k9scli.io/topics/hotkeys/
[27]: https://github.com/derailed/k9s/tree/master/plugins

View File

@ -0,0 +1,136 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to create a personal file server with SSH on Linux)
[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
怎样在 Linux 下用 SSH 搭建私人文件服务器
======
通过 SSH 连接远程 Linux 系统很简单。下面是教程。
![Hand putting a Linux file folder into a drawer][1]
使用树莓派可以搭建对很多事物有用的廉价家庭服务器。我的树莓派最常用来做[打印服务器][2],可以在我的家庭网络中共享激光打印机,或作为私人文件服务器保存项目副本和其他数据。
我的文件服务器有很多用途。假设我现在有一个项目,比如一本新书,我想备份我的工作的快照和所有关联的文件。这种场景下,我只需要把 **BookProject** 文件夹复制到文件服务器的 **BookBackup** 文件夹。
或者我现在正在清理我的本地文件,我发现有些文件现在不需要,但是我不确定是否要删除,我会把它们复制到文件服务器的 **KeepForLater** 文件夹。对于清理我日常用的 Linux 系统上杂乱的文件,以及把不常用的文件备份到私人文件服务器,这是一种很方便的方法。
用树莓派或其他 Linux 系统搭建私人文件服务器不需要配置 NFS<ruby>网络文件系统<rt>Network File System</rt></ruby>>)或 CIFS<ruby>通用互联网文件系统<rt>Common Internet File System</rt></ruby>)或改造其他的文件共享系统如 WebDAV。你可以很轻松的使用 SSH 来搭建远程文件服务器。下面是教程。
### 在远程服务器上配置 SSHD
你的 Linux 系统可能已经安装了 SSH daemonsshd甚至它是默认执行的。如果没有运行你可以使用你 Linux 发行版本上你想要的任何控制面板来轻松配置 SSH。我在树莓派上运行了 [Fedora ARM][3],通过把树莓派的 web 浏览器指向 9090 端口,我可以远程访问控制面板。(在我的家庭网络中,树莓派的 IP 地址是 **10.0.0.11**,因此我连接的是 **10.0.0.11:9090**。)如果 SSH daemon 默认没有运行,你可以在控制面板的 Services 里把它设置为开机启动。
![sshd in the list of system services][4]
你可以在系统服务列表里找到 sshd。
![slider to activate sshd][5]
如果 **sshd** 没有开启,点击切换按钮打开它。
### 你有账号吗?
你需要有个远程系统的账号。它可以与你本地系统的账号相同,也可以不同。
在流行的 Raspbian 发行版本上,默认的账号名是 **pi**。但是其他的 Linux 发行版本可能需要你在安装系统时就设置一个独一无二的新用户。如果你不知道你的用户名,你可以用系统的控制面板创建一个。在我的树莓派上,我创建了一个 **jhall** 账号,与我日常用的 Linux 桌面机器的用户名相同。
![Set up a new account on Fedora Server][6]
如果你用的是 Fedora 服务器,你可以点击 **Create New Account** 按钮来创建新账号。
![Set password or SSH key][7]
不要忘记设置密码或添加公钥。
### 可选:添加公钥
如果你把公钥添加到远程 Linux 系统上,你就可以不使用密码登录。这一步是可选的;如果你愿意,你仍可以用密码登录。
你可以在下面 Opensource.com 的文章中学到更多关于 SSH key 的信息:
* [SSH key 管理工具][8]
* [用 Seahorse 对 SSH key 进行图形化管理][9]
* [如何管理多个 SSH key][10]
* [使用 GPG key 作为鉴权依据开启 SSH 访问][11]
### 创建文件管理器快捷方式
现在你已经在远程系统上启动 SSH daemon 了,也设置了用户名和密码,最后一步就是在你本地的文件管理器中创建一个快捷方式,地址映射到远程 Linux 系统。我的桌面是 GNOME但是在其他的 Linux 桌面上的基本操作步骤都是一样的。
#### 建立初始连接
在 GNOME 的文件管理器中,在左边导航栏找到 **+Other Locations** 按钮。点击它会出现一个 **Connect to Server** 提示框。在框中输入远程 Linux 服务器的地址,地址以 SSH 连接协议开头。
![Creating a shortcut in GNOME file manager][12]
GNOME 文件管理器支持多种连接协议。以 **sftp://****ssh://** 开头的服务器地址,会创建 SSH 连接。
如果你远程 Linux 系统的用户名与本地的相同,那么你只需要输入服务器的地址和文件夹路径就可以了。比如要连接到我的树莓派的 **/home/jhall** 目录,我输入:
```
`sftp://10.0.0.11/home/jhall`
```
![GNOME file manager Connect to Server][13]
如果你远程 Linux 系统的用户名与本地的不同,你可以在远程系统地址前加 **@** 符号来指定远程系统的用户名。要连接到远程的 Raspbian 系统,你可能要输入:
```
`sftp://pi@10.0.0.11/home/pi`
```
![GNOME file manager Connect to Server][14]
如果你没有把公钥添加到远程服务器那么你需要输入密码。如果你已经添加GNOME 文件管理器应该会自动打开远程系统上的文件夹来让你跳转到不同的目录。
![GNOME file manager connection][15]
#### 创建一个快捷方式,之后就可以轻松连接服务器
在 GNOME 文件管理器中,这很简单。右击导航栏中远程系统的名字,选择 **Add Bookmark** 。这一步操作就创建了连接到远程路径的快捷方式。
![GNOME file manager - adding bookmark][16]
如果你想把标签中的快捷方式改成一个更容易记的名字,你可以右击快捷方式选择 **Rename**
### 总结!
通过 SSH 连接到远程 Linux 系统是很简单的事。你可以用相同的方式连接到家庭文件服务器以外的其他系统。我还创建了一个能让我立即访问我的提供商的 web 服务器上的文件的快捷方式和另一个能迅速打开我的项目服务器的文件夹的快捷方式。SSH 保证了它们是安全的连接;所有的传输都是加密的。当我通过 SSH 打开远程的文件时,我可以像在本地操作一样使用 GNOME 文件管理器轻松打开远程文件。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/3/personal-file-server-ssh
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://opensource.com/article/18/3/print-server-raspberry-pi
[3]: https://arm.fedoraproject.org/
[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services)
[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd)
[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server)
[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key)
[8]: https://opensource.com/article/20/2/ssh-tools
[9]: https://opensource.com/article/19/4/ssh-keys-seahorse
[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage
[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh
[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager)
[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server)
[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server)
[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection)
[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark)

View File

@ -0,0 +1,143 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Tricks for getting around your Linux file system)
[#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
使用 Linux 文件系统的技巧
======
cd 命令可能是任何 Linux 用户学习的前 10 个命令之一,但这并不是在 Linux 文件系统中切换的唯一方法,这里还有其他一些方法。
无论你是在文件系统中四处查看、寻找文件还是尝试进入重要目录Linux 都可以提供很多帮助。在本文中,我们将介绍一些技巧,使你可以在文件系统中移动,查找和使用所需的命令也更加轻松。
### 添加到 $PATH
确保你不必花费大量时间在 Linux 系统上查找命令的最简单、最有用的方法之一就是在 $PATH 变量中添加适当的目录。但是,添加到 $PATH 变量中的目录顺序非常重要。它们确定系统在目录中查找要运行命令的目录顺序--在找到第一个匹配项时停止。
例如,你可能希望将家目录放在第一个,这样,如果你创建的脚本与其他可执行文件有相同的名称,那么只要输入该脚本的名称,它便会运行。
要将家目录添加到 $PATH 变量中,可以执行以下操作:
```
$ export PATH=~:$PATH
```
**~** 字符代表家目录。
如果将脚本保存在 bin 目录中,下面的会有效:
```
$ export PATH=~/bin:$PATH
```
然后,你可以运行位于家目录中的脚本,如下所示:
[][2]
```
$ myscript
Good morning, you just ran /home/myacct/bin/myscript
```
**重要提示:**上面的命令_添加_搜索路径因为 $PATH (当前路径)包含了。它们不会覆盖它。你的搜索路径应该在 **.bashrc** 文件中配置,任何持久更改也需要在这里添加。
### 使用符号链接
符号链接提供了一种简单而明显的方式来记录可能经常需要使用的目录的位置。例如,如果你管理网站的内容,那么可能需要通过创建如下链接来使你的帐户“记住”网页文件的位置:
```
ln -s /var/www/html www
```
参数的顺序很重要。第一个(/var/www/html是目标第二个是你创建的链接的名称。如果你当前不在家目录中那么以下命令将执行相同的操作
```
ln -s /var/www/html ~/www
```
设置好之后,您可以使用 “cd www” 进入 **/var/www/html**。
### 使用 shopt
**shopt** 命令还提供了一种让移动到其他目录更加容易的方法。当你使用 **shopt****autocd** 选项时,只需输入名称即可转到目录。例如:
```
$ shopt -s autocd
$ www
cd -- www
/home/myacct/www
$ pwd -P
/var/www/html
$ ~/bin
cd -- /home/myacct/bin
$ pwd
/home/myacct/bin
```
在上面的第一组命令中,启用了 shopt 命令的 autocd 选项。输入 **www**,然后调用 “cd www” 命令。由于此符号链接是在上面的 **ln** 命令示例之一中创建的,因此将我们移至 **/var/www/html**。 **pwd -P** 命令显示实际位置。
在第二组中,键入 **~/bin** 会在用户家目录调用 **cd** 进入 **bin** 目录。
请注意,当你输入的是命令时,**autocd** 行为将_不会_生效即使它也是目录的名称。
**shopt** 是 bash 内置,它有很多选项。这只是意味着你不必在要进入每个目录的名称之前输入 “cd”。
要查看 **shopt** 的其他选项,只需输入 “shopt”。
### 使用 $CDPATH
进入特定目录的最有用技巧之一可能是将你希望能够轻松进入的路径添加到 **$CDPATH** 中。这将创建一个只需输入完整路径名的一部分即可进入的目录列表。
一方面,这可能有点棘手。你的 **$CDPATH** 需要包含要移动到的目录的目录,而不是目录本身。
例如,假设你希望仅通过输入 “cd html” 就可以移至 **/var/www/html** 目录,并仅使用 “cd” 和简单目录名即可移至 /var/log 中的子目录。在这种情况下,此 **$CDPATH** 将起作用:
```
$ CDPATH=.:/var/log:/var/www
```
你将看到:
```
$ cd journal
/var/log/journal
$ cd html
/var/www/html
```
当你输入的不是完整路径时,**$CDPATH** 就会生效。它向下查看其目录列表,以查看指定的目录是否存在于其中一个目录中。找到匹配项后,它将带你到那里。
保持 “.” 在 **$CDPATH** 开头意味着你可以进入本地目录,而不必在 **$CDPATH** 中定义它们。
```
$ export CDPATH=".:$CDPATH"
$ Videos
cd -- Videos
/home/myacct/Videos
```
在 Linux 文件系统键切换并不难,但是如果你使用一些方便的技巧轻松地到达各个位置,那你可以节省一些大脑细胞。
加入 [Facebook][3] 和 [LinkedIn][4] 上的 Network World 社区,评论热门主题。
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy)
[3]: https://www.facebook.com/NetworkWorld/
[4]: https://www.linkedin.com/company/network-world

View File

@ -1,83 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Customizing my open source PHP framework for web development)
[#]: via: (https://opensource.com/article/20/5/codeigniter)
[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14)
自定义用于 Web 开发的开源 PHP 框架
======
Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。
![Business woman on laptop sitting in front of window][1]
PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对安静的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。
我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务不够普遍,无法成为模板或现有后端的默认功能集,因此我需要提供可以依靠的良好,坚实,原始的东西。最初,我考虑用其他平台(如 Wordpress用于我们的网站。但是我决定使用 Codeigniter因为它的灵活性以及在学费匹配过程中需要的整合功能。
以下是让我使用 Codeigniter 的原因:
* 与 MySQL 的数据库集成—一种主要功能是允许客户端浏览导师数据库并添加导师,例如类似于电子商务平台的“购物车”。
  * 客户端界面系统—用户可以登录管理首选项并编辑详细信息,修改所教的科目、地区、手机号码、地址等。
  * 定制的管理员面板—管理员可以使用定制的管理面板访问客户提交的内容,它与客户服务功能集成在一起,因此管理员可以单独跟进。
  * 付款系统—管理面板带有与 Paypal 集成的发票和付款网关。
  * CMS 编辑器界面—管理员能够编辑博客和文章中的文本和图像,以及添加新页面。
该项目花费了大约六个月的时间来完成,另外花了两个月的调试时间。如果我需要从头开始构建所有,或者尝试重新设计现有的框架以满足我们的需求,那将花费更长的时间,而且可能最终无法满足客户需求。
### 功能和优点
还有许多吸引开发人员使用 PHP Codeigniter 的功能,包括错误处理和代码格式化,这些功能在每种编码情景下都非常有用。它支持模板,可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。
Codeigniter 的主要功能是:
* XML 核心服务,
  * HTTP/FTP 核心服务
  * AppData 和 PHP 沙箱功能
  * XSLT 和 HTML 模板
  * 加密的信息传输
  * PCM Codeigniter 服务器监控
  * 应用集成
  * 文件传输协议FTP
  * 服务台支持
  * Apache POI用于托管网站的内容管理基础架构
#### 兼容性
Codeigniter 与许多领先的软件程序兼容,例如 PHP、MySQL、[MariaDB][3]、[phpMyAdmin][4]、[Apache][5]、OpenBSD、XSLT、[SQLite][6] 等。许多公司更喜欢使用 Codeigniter 产品来满足网站要求,因为它们易于使用和集成。如果你不想创建自己的网站,你可以找到许多提供自定义 Web 开发服务的开发人员和设计机构。
#### 安全
Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙等外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。
#### 其它功能
一家优秀的 PHP Web 开发公司使用几种高级和第三方技术,例如 XML 和 PHP。它提供组织一个完整的平台来开发具有专业外观、有用的商业网站。Codeigniter 让使用第三方技术变得容易,并可以与常见的 Web 开发软件一起使用。这使得 web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。
### 使用 PHP 框架 Codeigniter
Codeigniter 给企业提供完整的 PHP 开发包,它将提供功能,灵活性和性能的正确组合。到目前为止,我很满意我们的网站,一直以来,我不断升级和添加新的功能。我期待用 Codeigniter 对我们的网站做些其他什么。你也是这样么?
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/5/codeigniter
作者:[Wee Ben Sen][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/bswee14
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
[2]: https://codeigniter.com/
[3]: http://mariadb.org/
[4]: https://www.phpmyadmin.net/
[5]: http://apache.org/
[6]: http://sqlite.org/

View File

@ -0,0 +1,232 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Speed up administration of Kubernetes clusters with k9s)
[#]: via: (https://opensource.com/article/20/5/kubernetes-administration)
[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb)
用 k9s 加速 Kubernetes 集群管理
======
> 看看这个很酷的 Kubernetes 管理的终端 UI。
![Dogs playing chess][1]
通常情况下,我写的关于 Kubernetes 管理的文章中,都是做集群管理的 `kubectl` 命令。然而最近,有人给我介绍了 [k9s][2] 项目,可以让我快速查看和解决 Kubernetes 中的日常问题。这对我的工作流程有了很大的改善,我将在本教程中告诉你如何上手。 
它的安装可以在 Mac、Windows 和 Linux 中进行。每种操作系统的说明可以在这里找到[这里][2]。请务必完成安装,以便能够跟上本教程。
我将使用 Linux 和 Minikube这是一种在个人电脑上运行 Kubernetes 的轻量级方式。按照[此教程][3]或使用[该文档][4]来安装它。
### 设置 k9s 配置文件
安装好 `k9s` 应用后,从帮助命令开始总是很好的。
```
$ k9s help
```
正如你所看到的,我们可以用 `k9s` 来配置很多功能。我们唯一需要进行的步骤就是写一个配置文件。而`info` 命令会告诉我们应用程序要在哪里找该配置文件。
```
$ k9s info
 ____  __.________
|    |/ _/   __   \\______
|      &lt; \\____    /  ___/
|    |  \   /    /\\___ \
|____|__ \ /____//____  &gt;
        \/            \/
Configuration:   /Users/jess/.k9s/config.yml
Logs:            /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log
Screen Dumps:    /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess
```
如果要添加一个配置文件,该目录不存在的话就创建一个目录,然后添加一个配置文件。
```
$ mkdir -p ~/.k9s/
$ touch ~/.k9s/config.yml
```
在这篇介绍中,我们将使用 k9s 版本库中推荐的默认 `config.yml`。维护者注意,这种格式可能会有变化,所以我们可以[在这里查看][5]最新版本。
```
k9s:
  refreshRate: 2
  headless: false
  readOnly: false
  noIcons: false
  logger:
    tail: 200
    buffer: 500
    sinceSeconds: 300
    fullScreenLogs: false
    textWrap: false
    showTime: false
  currentContext: minikube
  currentCluster: minikube
  clusters:
    minikube:
      namespace:
        active: ""
        favorites:
       - all
        - kube-system
        - default
      view:
        active: dp
  thresholds:
    cpu:
      critical: 90
      warn: 70
    memory:
      critical: 90
      warn: 70
```
我们设置了 `k9s` 寻找本地的 minikube 配置,所以我要确认 minikube 已经上线了,就可以使用了。
```
$ minikube status
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
```
### 运行 k9s 来探索一个 Kubernetes 集群
有了配置文件,并指向我们的本地集群,我们现在可以运行 `k9s` 命令了。
```
$ k9s
```
启动后,会弹出 `k9s` 基于文本的用户界面。在没有命名空间标志的情况下,它会向你显示默认命名空间中的 Pod。
![K9s screenshot][6]
如果你运行在一个有很多 Pod 的环境中,默认的视图可能会让人不知所措。或者,我们可以将注意力集中在给定的命名空间上。退出应用程序,运行 `k9s -n <namespace>`,其中 ``<namespace>` 是已有的命名空间。在下图中,我运行了 `k9s -n minecraft`,它显示了我的损坏的 Pod
![K9s screenshot][7]
所以,一旦你有了 `k9s` 后,有很多事情你可以更快地完成。 
通过快捷键来导航 `k9s`,我们可以随时使用方向键和回车键来选择列出的项目。还有不少其他的通用快捷键来导航到不同的视图。
* `0`:显示在所有命名空间中的所有 Pod
![K9s screenshot][8]
* `d`:描述所选的 Pod
![K9s screenshot][9]
* `l`:显示所选的 Pod 的日志
![Using k9s to show Kubernetes pod logs][10]
你可能会注意到 `k9s` 被设置为使用 [Vim 命令键][11],包括使用 `J``K` 键上下移动。Emacs 用户们,败退吧 :)
### 快速查看不同的 Kubernetes 资源
需要去找一个不在 Pod 里的东西吗?是的,我也需要。当我们输入冒号(`:`)键时,可以使用很多快捷方式。从那里,你可以使用下面的命令来导航。
* `:svc`:跳转到服务视图
![K9s screenshot][12]
* `:deploy`:跳转到部署视图
![K9s screenshot][13]
* `:rb`:跳转到角色绑定视图,用于 [基于角色的访问控制RBAC][14]管理
![K9s screenshot][15]
* `:namespace`:跳转到命名空间视图
![K9s screenshot][16]
* `:cj`:跳转到 cronjob 视图,查看集群中计划了哪些作业。
![K9s screenshot][17]
这个应用最常用的工具是键盘;要在任何页面上往上或往下翻页,请使用方向键。如果你需要退出,记得使用 Vim 键绑定。键入 `:q`,然后按回车键离开。
### 用 k9s 排除 Kubernetes 的故障示例
当出现故障的时候,`k9s` 怎么帮忙?举个例子,我让几个 Pod 由于配置错误而死机。下面你可以看到我那个可怜的 “hello” 部署死了。当我们将其高亮显示出来,可以按 `d` 运行 `describe` 命令,看看是什么原因导致了故障。
![K9s screenshot][18]
![K9s screenshot][19]
草草掠过那些事件并不能告诉我们故障原因。接下来,我按了 `esc` 键,然后通过高亮显示 Pod 并输入`shift-l` 来检查日志。
![K9s screenshot][20]
不幸的是,日志也没有提供任何有用的信息(可能是因为部署从未正确配置过),而且 Pod也不会出现。
然后我使用 `esc` 退了出来,我看看删除 Pod 是否能解决这个问题。要做到这一点,我高亮显示 Pod然后使用 `ctrl-d`。幸好 `k9s` 在删除前会提示用户。 
![K9s screenshot][21]
虽然我确实删除了这个 Pod但部署资源仍然存在所以新的 Pod 会重新出现。它还会继续重启并死掉,无论什么原因(我们还不知道)。
在这里,我会重复查看日志,描述资源,甚至使用 `e` 快捷方式来编辑运行中的 Pod 以排除故障行为。在这个特殊情况下,失败的 Pod 没有配置在这个环境下运行。因此,让我们删除部署来停止崩溃接着重启的循环。
我们可以通过键入 `:deploy` 并点击回车进入部署。从那里我们高亮显示并按 `ctrl-d` 来删除。
![K9s screenshot][22]
![K9s screenshot][23]
部署失败了! 只用了几个按键就把这个失败的部署给清理掉了。
### k9s 是极其可定制的
这个应用有很多自定义选项,乃至于 UI 的配色方案。这里有几个可编辑的选项,你可能会感兴趣。
* 调整你把 `config.yml` 文件放置的位置(这样你就可以把它存储在[版本控制][24]中)。
* 在 `alias.yml` 文件中添加[自定义别名][25]。
* 在 `hotkey.yml` 文件中创建[自定义热键][26]。
* 探索现有的[插件][27]或编写自己的插件。
整个应用是在 YAML 文件中配置的,所以定制化对于任何 Kubernetes 管理员来说都会觉得很熟悉。
### 用 k9s 简化你的生活
我很容易在团队的系统上用非常人工的方式进行管理,更多的是为了锻炼脑力,而不是别的。当我第一次听说 `k9s` 的时候,我想,“这只是懒惰的 Kubernetes 而已。”于是我否定了它,回到了到处进行人工干预的状态。实际上,我在处理我的积压工作时就开始每天使用它,我觉得它的使用速度比单独使用 `kubectl` 快得多,这让我大吃一惊。现在,我已经皈依了。 
了解你的工具并掌握做事情的“硬道理”很重要。还有一点很重要的是要记住,就管理而言,重要的是要更聪明地工作,而不是更努力。使用 `k9s`,就是我践行这个目标的方法。我想,我们可以把它叫做懒惰的 Kubernetes 管理,也没关系。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/5/kubernetes-administration
作者:[Jessica Cherry][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/cherrybomb
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess)
[2]: https://github.com/derailed/k9s
[3]: https://opensource.com/article/18/10/getting-started-minikube
[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/
[5]: https://github.com/derailed/k9s#k9s-configuration
[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot)
[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot)
[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot)
[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot)
[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs)
[11]: https://opensource.com/article/19/3/getting-started-vim
[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot)
[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot)
[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot)
[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot)
[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot)
[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot)
[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot)
[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot)
[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot)
[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot)
[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot)
[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control
[25]: https://k9scli.io/topics/aliases/
[26]: https://k9scli.io/topics/hotkeys/
[27]: https://github.com/derailed/k9s/tree/master/plugins