X240 Ubuntu18.04安装流水帐

时间:2022-01-23 06:21:15

U盘安装

使用Startup Disk Creator和下载好的iso文件创建启动U盘 (在win7下官网建议的刻录软件是Rufus, https://rufus.akeo.ie/)

Nautilus无法使用type-ahead功能

18.04的默认文件浏览器Nautilus彻底删除了type-ahead功能, 在浏览中输入按键会自动变成全系统搜索, 这个对日常使用造成了很大的不便. 在Nautilus的项目主页上有很长的讨论 https://gitlab.gnome.org/GNOME/nautilus/issues/244https://gitlab.gnome.org/GNOME/nautilus/issues/466https://gitlab.gnome.org/GNOME/nautilus/issues/590https://gitlab.gnome.org/GNOME/nautilus/issues/923https://gitlab.gnome.org/GNOME/nautilus/issues/1157

Update 2018-06-18: 可以通过一个第三方的ppa替换成带type-ahead功能的Nautilus:

sudo add-apt-repository ppa:lubomir-brindza/nautilus-typeahead
sudo apt update
sudo apt dist-upgrade

如果要恢复回自带Nautilus的话:

sudo apt install ppa-purge
sudo ppa-purge ppa:lubomir-brindza/nautilus-typeahead

禁用指点杆的中键粘贴 Disabling Trackpoint middle-mouse button paste

默认的中键功能是: 点击立即释放是粘贴(作用在浏览器中是新标签页打开链接或关闭窗口), 点击并移动指点杆是滚动页面. 但是因为X240触摸板的失败设计, 左键和中键没有明显的区分, 在工作中经常造成误击中键, 而且经常由于食指和拇指配合不好导致页面滚动变成了粘贴. 这在写代码的过程中尤为恼人.

在18.04中, xinput的输出已经和16.04不一样, 原先的设置 xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Timeout" 1 已经无效. 通过gnom-tweak-tool 设置禁用鼠标中键粘贴对这个也不起作用. 有一篇文章说安装xserver-xorg-input-synaptics替代xserver-xorg-input-libinput, 但是尝试无效(也许我的方法不对..). 各种尝试得到的结果是, 只能通过set-button-map 将中键禁用. 参考 https://wiki.ubuntu.com/X/Config/Input

# 查看xinput设备列表
milton@milton-X240:~$ xinput list
⎡ Virtual core pointer id= [master pointer ()]
⎜ ↳ Virtual core XTEST pointer id= [slave pointer ()]
⎜ ↳ SynPS/ Synaptics TouchPad id= [slave pointer ()]
⎜ ↳ TPPS/ IBM TrackPoint id= [slave pointer ()]
⎣ Virtual core keyboard id= [master keyboard ()]
↳ Virtual core XTEST keyboard id= [slave keyboard ()]
↳ Power Button id= [slave keyboard ()]
↳ Video Bus id= [slave keyboard ()]
↳ Sleep Button id= [slave keyboard ()]
↳ Integrated Camera: Integrated C id= [slave keyboard ()]
↳ AT Translated Set keyboard id= [slave keyboard ()]
↳ ThinkPad Extra Buttons id= [slave keyboard ()] # 对应指点杆的设备是id=
milton@milton-X240:~$ xinput list-props
Device 'TPPS/2 IBM TrackPoint':
Device Enabled ():
Coordinate Transformation Matrix (): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled ():
libinput Natural Scrolling Enabled Default ():
libinput Scroll Methods Available (): , ,
libinput Scroll Method Enabled (): , ,
libinput Scroll Method Enabled Default (): , ,
libinput Button Scrolling Button ():
libinput Button Scrolling Button Default ():
libinput Middle Emulation Enabled ():
libinput Middle Emulation Enabled Default ():
libinput Accel Speed (): -0.690647
libinput Accel Speed Default (): 0.000000
libinput Accel Profiles Available (): ,
libinput Accel Profile Enabled (): ,
libinput Accel Profile Enabled Default (): ,
libinput Left Handed Enabled ():
libinput Left Handed Enabled Default ():
libinput Send Events Modes Available (): ,
libinput Send Events Mode Enabled (): ,
libinput Send Events Mode Enabled Default (): ,
Device Node (): "/dev/input/event6"
Device Product ID (): ,
libinput Drag Lock Buttons (): <no items>
libinput Horizontal Scroll Enabled (): # 查看按键, 其中1, , 3分别对应的 左, 中, 右键
milton@milton-X240:~$ xinput get-button-map # 将中键禁用
milton@milton-X240:~$ xinput set-button-map

这个并不能永久保存, 需要写入bashrc等以便于每次启动桌面时自动生效. 如果安装了xserver-xorg-input-synaptics, 会导致中键又生效...
终于可以愉快地中键翻屏, 不用担心中途不小心粘贴什么了.

指点杆加速度

在gnom-tweak-tool里可以选择三种profile: adaptive, normal, flat: The profile decides the general method of pointer acceleration. libinput currently supports two profiles: "adaptive" and "flat". The aptive profile is the default profile for all devices and takes the current speed of the device into account when deciding on acceleration. The flat profile is simply a constant factor applied to all device deltas, regardless of the speed of motion. https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html
选adaptive感觉比较适合1080p分辨率下的桌面. 有一定的加速度, 又不会太灵敏.

安装WPS

直接安装deb包会报错

$ sudo dpkg -i wps-office_10.1.0.~a21_amd64.deb
Selecting previously unselected package wps-office.
(Reading database ... files and directories currently installed.)
Preparing to unpack wps-office_10.1.0.~a21_amd64.deb ...
Unpacking wps-office (10.1.0.5672~a21) ...
dpkg: dependency problems prevent configuration of wps-office:
wps-office depends on libpng12-; however:
Package libpng12- is not installed. dpkg: error processing package wps-office (--install):
dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.-11ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3) ...
Processing triggers for mime-support (.60ubuntu1) ...
Processing triggers for shared-mime-info (1.9-) ...
Processing triggers for hicolor-icon-theme (0.17-) ...
Errors were encountered while processing:
wps-office

18.04本身不带这个版本的libpng, 要通过第三方包安装

ibpng12-0下载: http://archive.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.27-2+lenny5_amd64.deb
安装libpng12-0:

sudo dpkg -i libpng12-0_1.2.27-+lenny5_amd64.deb

之后再安装就成功了

Update 2018-08-21: WPS has released wps-office_10.1.0.6634_amd64 on Jun 5, libpng is not needed now.

Update 2019-10-11: WPS has released wps-office_11.1, same installation steps.

安装PAC Manager

ubuntu自带的pac版本是4.5.5.8, 比sourceforge上的版本还高... 所以直接通过ubuntu软件中心安装了

安装Redis 4.0.9

先安装gcc,  sudo apt-get install gcc, 然后解压编译, 编译出现错误  error: jemalloc/jemalloc.h: No such file or directory

可以通过强制使用libc的malloc进行编译 Selecting a non-default memory allocator when building Redis is done by setting  the `MALLOC` environment variable. Redis is compiled and linked against libc  malloc by default, with the exception of jemalloc being the default on Linux  systems. This default was picked because jemalloc has proven to have fewer  fragmentation problems than libc malloc.  To force compiling against libc malloc, use:  
    % make MALLOC=libc 
To compile against jemalloc on Mac OS X systems, use: 
    % make MALLOC=jemalloc

要运行make test需要安装 tcl

sudo make
sudo make test
# 安装到/opt/redis/redis-4.0./bin下, 然后再到/usr/bin去建好软链
sudo make PREFIX=/opt/redis/redis-4.0. install

配置

复制源代码目录下自带的conf模板 /usr/src/redis-4.0.9/redis.conf 到 /opt/redis/redis-4.0.9/conf, 需要编辑的变量

port 6039
daemonize yes
pidfile /var/run/redis_6039.pid
logfile "/var/redis/log/redislog"
databases 8
dir /var/redis/data
requirepass foobard

服务init.d脚本, 可以在源码的utils目录下找到一个 redis_init_script 文件, 按下面的格式修改

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: redis
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/ Stop Redis Server daemon
# Description: This service script facilitates startup and shutdown of
# redis daemon
### END INIT INFO
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem. REDISPORT=6039
EXEC=/opt/redis/latest/bin/redis-server
CLIEXEC=/opt/redis/latest/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/opt/redis/latest/conf/${REDISPORT}.conf"
SECURE=foobard case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REDISPORT -a $SECURE shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac

将redis加入service, 添加完/etc/init.d/redis后, 还是不能用sudo service redis start来启动的, 需要先通过systemctl enable 命令来添加

$ sudo service redis start
Failed to start redis.service: Unit redis.service not found.
$ sudo systemctl enable redis
redis.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable redis

之后就能用sudo service redis start/stop来控制redis服务了.

如果需要禁止开机启动, 也可以通过systemctl

sudo systemctl disable mysql
sudo systemctl enable redis
sudo systemctl disable redis

查看系统中的服务, 会显示服务是否开机启动(enable or disable)

sudo systemctl list-unit-files

安装unar

避免解压包含中文文件名的zip时产生乱码

sudo apt-get install unar

安装MySQL

(安装过程略)

Update 2018-11-27: 通过apt安装的mysql, 其配置文件位于/etc/mysql/, 其中的/etc/mysql/mysql.conf.d/mysqld.cnf 是服务端的配置信息 (虽然在/etc/mysql/mysql.cnf中两个includedir前面都有 ! 号, 不确定这是表示引用还是不引用).

Update 2018-06-14: 在安装了mysql-8.0之后, 因为client与原先的mysql5.7不兼容, 不得已还是把8.0卸载了重新安装5.7, 其中碰到的一些问题:
1. 重新安装5.7后, service mysql start一直失败, 后来发现是原先的数据目录还存在, 5.7用原先的数据启动导致失败. 将/var/lib/mysql目录删除后, 再卸载&安装5.7, 就可以正常启动了
2. root登录口令. 因为安装过程中并未提示输入口令, 所以采用了 mysqld_safe --skip-grant-tables 的方式启动后再登录命令行, 修改口令, 但是很奇怪的是一直不生效, 命令行连接后依然出现 ERROR 1698 (28000): Access denied for user 'root'@'localhost' 错误, 但是用sudo mysql -uroot 却不需要口令就可以登录, 后来google发现是这个原因:

The reason is that recent Ubuntu installation (maybe others also), mysql is using by default the UNIX auth_socket plugin. Basically means that: db_users using it, will be "auth" by the system user credentias. You can see if your root user is set up like this by doing the following:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user; +------------------+-----------------------+
| User | plugin |
+------------------+-----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+

As you can see in the query, the root user is using the auth_socket plugin
There are 2 ways to solve this:
  You can set the root user to use the mysql_native_password plugin
  You can create a new db_user with you system_user (recommended)
Option 1:

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit; $ service mysql restart

Option 2: (replace YOUR_SYSTEM_USER with the username you have)

$ sudo mysql -u root # I had to use "sudo" since is new installation

mysql> USE mysql;
mysql> CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'YOUR_SYSTEM_USER'@'localhost';
mysql> UPDATE user SET plugin='auth_socket' WHERE User='YOUR_SYSTEM_USER';
mysql> FLUSH PRIVILEGES;
mysql> exit; $ service mysql restart

Remember that if you use option #2 you'll have to connect to mysql as your system username (mysql -u YOUR_SYSTEM_USER)

安装sublime text3

参考 http://www.cnblogs.com/milton/p/4215116.html
下载当前最新的deb https://download.sublimetext.com/files/sublime-text_build-3170_amd64.deb   
修复fcitx无法输入中文的问题: https://github.com/lyfeyaj/sublime-text-imfix  git clone到本地后, 执行一下./sublime-imfix就完成修复了.

安装 gnome-tweak-tool 调整字体

sudo apt install gnome-tweak-tool

安装 chrome-gnome-shell 因为需要用到 unite-shell extension

sudo apt-get install chrome-gnome-shell

安装 unite-shell extension

访问网址 https://github.com/hardpixel/unite-shell . 根据页面的安装说明, 在releases里面下载最新的zip包, 解压缩至 ~/.local/share/gnome-shell/extensions
注意: 1)如果路径不存在则创建路径 2)解压完后, 重启桌面即可在 gnome-tweak-tool 的extensions里看到unite. 这样安装不需要安装浏览器扩展. 3)如果开启后发现fctix消失, 可以重启一下ubuntu.

安装完后, 主要有两点改进: 1)将时钟移到了右侧, 2)最大化窗口时, 将窗口标题栏与ubuntu桌面顶栏合并, 节约空间

Update 2019-10-11: unite-shell-v33 doesn't work with 18.04, in tweak extensions panel it says "error loading extension", v18 works.

安装SS-libev

直接通过apt install 安装, ss-local会安装到/usr/bin/

安装截图软件Shutter

sudo apt install shutter

之后安装libgoo-canvas以启用编辑功能, 下载三个deb

https://launchpad.net/ubuntu/+archive/primary/+files/libgoocanvas-common_1.0.0-1_all.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libgoocanvas3_1.0.0-1_amd64.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libgoo-canvas-perl_0.06-2ubuntu3_amd64.deb

依次安装, 最后提示依赖问题用 sudo apt install -f修复

关闭上盖后禁止休眠

通过命令行修改 /etc/systemd/logind.conf, 将 HandleLidSwitch的值修改为ignore, 然后重启systemd-logind: sudo service system-logind restart

也可以通过Gnome Tweak Tool修改, 在power栏下有设置项.

电池阈值管理

需要将电池设置为 40%开始充电, 70%停止充电以最大限度延长电池使用寿命

需要apt install tlp, acpi-call-dkms 这两个软件, 用tlp setcharge [下限] [上限] [电池编号]设置阈值, 然后用 tlp-stat -b 查看

$ sudo tlp setcharge 50 80 BAT0
Setting temporary charge thresholds for BAT0:
stop = 80
start = 50
$ sudo tlp-stat -b
--- TLP 1.1 -------------------------------------------- +++ ThinkPad Battery Features
tp-smapi = inactive (unsupported hardware)
tpacpi-bat = active +++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/class/power_supply/BAT0/manufacturer = SONY
/sys/class/power_supply/BAT0/model_name = 45N1111
/sys/class/power_supply/BAT0/cycle_count = (not supported)
/sys/class/power_supply/BAT0/energy_full_design = 23200 [mWh]
/sys/class/power_supply/BAT0/energy_full = 20650 [mWh]
/sys/class/power_supply/BAT0/energy_now = 14560 [mWh]
/sys/class/power_supply/BAT0/power_now = 4376 [mW]
/sys/class/power_supply/BAT0/status = Discharging tpacpi-bat.BAT0.startThreshold = 50 [%]
tpacpi-bat.BAT0.stopThreshold = 80 [%]
tpacpi-bat.BAT0.forceDischarge = 0 Charge = 70.5 [%]
Capacity = 89.0 [%]

  

X240 Ubuntu18.04安装流水帐的更多相关文章

  1. T550 HiDPI Ubuntu 16&period;04安装流水帐

    U盘安装 需要用Win32DiskImager刻录iso到U盘 输入法 安装时选择的是英文, 所以默认没有中文的输入法, 但是浏览中文网页是没问题的, 而且字体都正常. 在System Setting ...

  2. ubuntu18&period;04 安装mysql不出现设置 root 帐户的密码问题(装)

    ubuntu18.04 安装mysql不出现设置 root 帐户的密码问题      https://blog.csdn.net/NeptuneClouds/article/details/80995 ...

  3. Ubuntu18&period;04安装mysql5&period;7

    Ubuntu18.04安装mysql5.7 1.1安装 首先执行下面三条命令: # 安装mysql服务 sudo apt-get install mysql-server # 安装客户端 sudo a ...

  4. Ubuntu18&period;04安装RabbitMQ

    Ubuntu18.04安装RabbitMQ 2018年06月10日 19:32:38 dmfrm 阅读数:2492    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog ...

  5. ubuntu18&period;04 安装hadoop 2&period;7&period;3&plus;hive 2&period;3&period;4

    1. 安装hadoop 详细请参见本人的另外一片博文<Hadoop 2.7.3 分布式集群安装> 2. 下载hive 2.3.4 解压文件到/opt/software -bin.tar.g ...

  6. Ubuntu18&period;04安装Virtualenv虚拟环境

    在Ubuntu18.04安装Virtualenv虚拟环境 [实验环境]: 在这台电脑上已经安装了python3 [安装参考] 1.查看是否已安装virtualenv virtualenv --vers ...

  7. Ubuntu18&period;04安装thunderbird并设置中文

    Ubuntu18.04安装thunderbird并设置中文 安装thunderbird sudo apt-get install thunderbird 安装中文包 sudo apt-get inst ...

  8. Ubuntu18&period;04安装Docker, centos7安装Docker

    Ubuntu18.04安装Docker 第一种方法从Ubuntu的仓库直接下载安装: 安装比较简单,这种安装的Docker不是最新版本,不过对于学习够用了,依次执行下面命令进行安装. $ sudo a ...

  9. Ubuntu18&period;04安装和配置Java JDK11并卸载自带OpenJDK

    卸载自带的OpenJDK方法: 在终端执行命令:sudo apt-get remove openjdk* Ubuntu18.04安装JDK11.0.2 前面步骤一样,可参考:https://www.c ...

随机推荐

  1. Android开发之XUtils框架使用和报错处理

    一.XUtils  lib的的添加: 1.点击+,选择第一个Library dependency 2.输入XUtils 按enter键,搜索: 3.然后就是选择XUtils,选择哪个版本就看个人了,接 ...

  2. P3381 【模板】最小费用最大流

    P3381 [模板]最小费用最大流 题目描述 如题,给出一个网络图,以及其源点和汇点,每条边已知其最大流量和单位流量费用,求出其网络最大流和在最大流情况下的最小费用. 输入输出格式 输入格式: 第一行 ...

  3. win7安装gevent时报错 whl is not a supported wheel on this platform&period;

    1.首先强烈推荐一个站点 在使用pip安装python协程包gevent时,需要很多依赖,很多需要编译的底层支持等等,不能拿来就用.总之很多麻烦的事儿. 这个强烈推荐一个站点,里面都是一些编译好的py ...

  4. python numpy基础 数组和矢量计算

    在python 中有时候我们用数组操作数据可以极大的提升数据的处理效率, 类似于R的向量化操作,是的数据的操作趋于简单化,在python 中是使用numpy模块可以进行数组和矢量计算. 下面来看下简单 ...

  5. 项目有叉号, 但是没有代码错误的时候, 是JDK版本的问题

    windows---proferences---java--compiler进入项目--properties---java Compiler进入项目--properties---Myeclipse-- ...

  6. 项目笔记:2018年4月(SpringCloud架构和SpringBoot框架)

    一.启动Euerka服务 1.在启动类里用@propertySource引入全局配置文件noteapp-service.properties: 如上图.左侧为某服务配置文件properties,右侧为 ...

  7. CSS之清除浮动&lpar;span&sol;clearfix&rpar;

    一.问题描述 web网页设计中,在div元素中有时候常伴有图文结合的post组件.为了使得文本在图像周围环绕,那么需要对图像区域使用float浮动.如果不做清除浮动,则会出现如下结果: 图像比文本高, ...

  8. 从零开始一起学习SLAM &vert; 相机成像模型

    上一篇文章<从零开始一起学习SLAM | 为啥需要李群与李代数?>以小白和师兄的对话展开,受到了很多读者的好评.本文继续采用对话的方式来学习一下相机成像模型,这个是SLAM中极其重要的内容 ...

  9. Selenium操作示例——鼠标悬停显示二级菜单,再点击二级菜单或下拉列表

    这两天在玩python中selenium,遇到一个问题,就是鼠标移动到页面中某按钮或菜单,自动弹出二级菜单或下拉菜单,再自动点击其中的二级菜单或下拉列表. 首先,手工操作:打开母校的主页 http:/ ...

  10. &lpar;转&rpar;JavaMail中的Flag&lpar;邮件状态&rpar;

    本文转载自:http://blog.csdn.net/chjttony/article/details/6005594 标记邮件就是把邮件标记为已读,删除等操作,需要使用Flags类,它mail.ja ...